Church details saved through Accounts' church.update (live at once). Settings: Search Console and Bing codes, Coming soon line, menu order. Audit log and recent edits. A made share image, Event / VideoObject / PodcastEpisode / BreadcrumbList structured data, permanent redirects from old page addresses. Saves refused when someone else saved in between; Ministry leaders' events; templates previewed with the church's own content before choosing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
962 B
TypeScript
18 lines
962 B
TypeScript
import { NextResponse, type NextRequest } from "next/server";
|
|
|
|
/**
|
|
* Preview (WEBSITE-1.0-PLAN §4): a signed-in admin sees the working copy on the site's own
|
|
* addresses, fully clickable. The cookie only asks for it; the backend checks the admin's session
|
|
* on every page (site/preview), so it shows nothing to anyone else.
|
|
*/
|
|
export function GET(request: NextRequest) {
|
|
const res = NextResponse.redirect(new URL("/", request.url), 303);
|
|
const opts = { httpOnly: true, sameSite: "lax" as const, secure: process.env.NODE_ENV === "production", path: "/" };
|
|
res.cookies.set("ccw_preview", "admin", opts);
|
|
// "Choose your template": the church's own content in another template, nothing saved.
|
|
const template = request.nextUrl.searchParams.get("template");
|
|
if (template && /^(heritage|bold|community|clean)$/.test(template)) res.cookies.set("ccw_preview_template", template, opts);
|
|
else res.cookies.delete("ccw_preview_template");
|
|
return res;
|
|
}
|