27 lines
718 B
TypeScript
27 lines
718 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { auth } from "@/app/(auth)/auth";
|
|
import { isPascalInternalRequest } from "@/lib/pascal/internal-auth";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
export const runtime = "nodejs";
|
|
|
|
export async function GET(request: Request) {
|
|
if (!isPascalInternalRequest(request)) {
|
|
return NextResponse.json({ error: "not_found" }, { status: 404 });
|
|
}
|
|
|
|
const session = await auth();
|
|
const userId = session?.user?.id?.trim();
|
|
if (!userId) {
|
|
return NextResponse.json({ error: "unauthorized" }, { status: 401 });
|
|
}
|
|
|
|
return new NextResponse(null, {
|
|
status: 204,
|
|
headers: {
|
|
"Cache-Control": "no-store",
|
|
"X-Pascal-User-Id": userId,
|
|
},
|
|
});
|
|
}
|