import $axios from "@/request/http";

export const topId = "00000000-0000-0000-0000-000000000000";

export const $imgAdd = function (args, editorRef) {
  const [pos, $file] = args;
  const formdata = new FormData();
  formdata.append("file", $file);
  formdata.append("directory", "image");
  $axios
    .post("/apaas/common/image/upload", formdata, {
      headers: { "Content-Type": "multipart/form-data" },
    })
    .then(({ data }) => {
      editorRef.$img2Url(pos, data.data);
    });
};
