editor-js/image

Image Tool: uploading failed because of incorrect response: {}

h0lme3 opened this issue · 2 comments

Hello, everybody.
I am using Next.js and editorjs to upload file(image).

    editor_ = await new EditorJS({
       ...
       image: {
          class: ImageTool,
          config: {
            uploader: {
              uploadByFile(file: File) {
                const formData = new FormData();
                formData.append("projectPubKey", projectPubKey);
                formData.append("image", file);

                return new Promise((resolve, reject) => {
                  fetch("/api/editor/init", {
                    method: "POST",
                    body: formData,
                  })
                    .then((res) => {
                      console.log(res, "res");
                      resolve(res);
                    })
                    .catch((error) => reject(error));
                });
              },
            },
          },
        },
       ...
    })

result:
image

with this error message
image

How can I figure it out? Any help? Thanks in advance!

It was issue on my end. Solved it.

How did you fix this?