15 lines
347 B
TypeScript
15 lines
347 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { getOrCreateCsrfToken } from '@/lib/csrf';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
/**
|
|
* GET /api/csrf
|
|
* Returns a CSRF token for the current session
|
|
*/
|
|
export async function GET() {
|
|
const token = getOrCreateCsrfToken();
|
|
|
|
return NextResponse.json({ csrfToken: token });
|
|
}
|