10 lines
357 B
TypeScript
10 lines
357 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { clearSession } from "@/lib/auth";
|
|
import { isSameOrigin } from "@/lib/validation";
|
|
|
|
export async function POST(request: Request) {
|
|
if (!isSameOrigin(request)) return new NextResponse(null, { status: 403 });
|
|
await clearSession();
|
|
return NextResponse.redirect(new URL("/login", request.url), 303);
|
|
}
|