a tool for shared writing and social publishing
1import { NextRequest, NextResponse } from "next/server";
2
3export async function POST(request: NextRequest) {
4 const { state } = (await request.json()) as { state: string };
5 if (state !== "home" && state !== "reader") {
6 return NextResponse.json({ error: "Invalid state" }, { status: 400 });
7 }
8
9 const response = NextResponse.json({ ok: true });
10 response.cookies.set("nav-state", state, {
11 path: "/",
12 sameSite: "lax",
13 maxAge: 60 * 60 * 24 * 365,
14 });
15 return response;
16}