react-email-editor
react-email-editor copied to clipboard
image export failing
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}
/>
)
})