templates2.Admin.Next/app/api/auth/logout/route.ts
w4c-templates c64f7ffa9e
Some checks failed
CI / quality (push) Has been cancelled
chore(template): publish Admin.Next
2026-10-11 23:25:34 +03:00

11 lines
379 B
TypeScript

import { NextResponse } from 'next/server';
import { destroySession } from '@/lib/server/auth';
export const dynamic = 'force-dynamic';
export async function POST() {
await destroySession();
// 303 so a plain HTML form POST turns into a GET of the home page.
return NextResponse.redirect(new URL('/', process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000'), 303);
}