13 lines
410 B
TypeScript
13 lines
410 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { destroyCurrentSession, getSessionUser } from "@/lib/session";
|
|
import { audit } from "@/lib/audit";
|
|
|
|
export async function POST() {
|
|
const user = await getSessionUser();
|
|
await destroyCurrentSession();
|
|
if (user) {
|
|
await audit({ actorId: user.id, action: "logout", entity: "User", entityId: user.id });
|
|
}
|
|
return NextResponse.json({ ok: true });
|
|
}
|