spb/autoscholar
Public
1import { SESSION_COOKIE } from "@autoscholar/auth";2import { logout } from "@autoscholar/core";3import { cookies } from "next/headers";4import { handler, json } from "@/lib/server/api";5import { db } from "@/lib/server/db";6import { requireAdmin } from "@/lib/server/session";78export const runtime = "nodejs";910export const POST = handler(async (req) => {11 await requireAdmin(req, { mutation: true, allowPendingRotation: true });12 const jar = await cookies();13 const token = jar.get(SESSION_COOKIE)?.value;14 if (token) await logout(db(), token);15 jar.set(SESSION_COOKIE, "", { httpOnly: true, path: "/", maxAge: 0 });16 return json({ ok: true });17});18