"use client";

import type { Data } from "@puckeditor/core";
import { Puck } from "@puckeditor/core";
import puckConfig from "../../../../puck.config";

export function Client({ path, data }: { path: string; data: Partial<Data> }) {
  return (
    <Puck
      config={puckConfig}
      data={data}
      onPublish={async (data) => {
        await fetch("/puck/api", {
          method: "post",
          body: JSON.stringify({ data, path }),
        });
      }}
    />
  );
}
