templates2.Base.Next/app/api/auth/logout/route.ts
w4c-templates 219be916cb
Some checks are pending
CI / quality (push) Waiting to run
chore(template): publish Base.Next
2026-10-11 23:23:30 +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);
}