Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image export failing #389

Open
geikobogdan opened this issue Mar 21, 2024 · 0 comments
Open

image export failing #389

geikobogdan opened this issue Mar 21, 2024 · 0 comments

Comments

@geikobogdan
Copy link

geikobogdan commented Mar 21, 2024

I have my apiKey and project id, but when I try to execute imageExport func I received 401. Attached screenshots with request details (request headers/url, payload). Code:

import { Editor } from "react-email-editor/dist/types"

const EmailEditorNoSSR = dynamic(() => import("react-email-editor").then((mod) => mod.default), { ssr: false })


const projectId = 11111 //your project id


export const EmailBuilderModal: FC<EmailBuilderProps> = ({ open, setOpen }) => {
  const emailEditorRef = useRef<EditorRef | null>(null)

  const onReady = (editor: Editor | null) => {
    if (editor) {
      emailEditorRef.current = {
        editor: editor,
        exportHtml: editor.exportHtml.bind(editor),
      }
      setIsLoading(true)
    }
  }


  const saveImage = async () => {
    if (emailEditorRef.current && emailEditorRef.current.editor) {
      emailEditorRef.current.editor.exportImage(({ design }) => {
        console.log(design, "design")
      }) // 401 error
    } 
  }

  return (
          <EmailEditorNoSSR
              projectId={projectId}
              ref={emailEditorRef}
              onReady={onReady}
            />
         )
})
Screenshot 2024-03-21 at 13 11 47 Screenshot 2024-03-21 at 13 13 18 Screenshot 2024-03-21 at 13 13 32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant