import { draftMode } from "next/headers";
import { redirect } from "next/navigation";

/**
 * GET /api/preview/disable
 *
 * Turns draftMode() off and sends the editor back to the homepage. No secret
 * needed — disabling preview is always safe.
 */
export async function GET() {
  const draft = await draftMode();
  draft.disable();
  redirect("/");
}
