use postMessage
This commit is contained in:
@@ -88,11 +88,12 @@ export default function EditorClient({
|
||||
|
||||
const persist = useCallback(async (route: string, next: any) => {
|
||||
setSchema((s) => ({ ...s, [route]: next }));
|
||||
await fetch("/api/save-schema", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ route, data: next }),
|
||||
});
|
||||
if (typeof window !== "undefined" && window.parent !== window) {
|
||||
window.parent.postMessage(
|
||||
{ type: "PUBLISH", path: route, data: next },
|
||||
"*",
|
||||
);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const plugins = useMemo(
|
||||
|
||||
Reference in New Issue
Block a user