hy2-panel/app/logout/route.ts

12 lines
346 B
TypeScript

import { NextResponse } from "next/server";
import { destroyAdminSession, destroyUserSession } from "@/lib/session";
export async function POST() {
await Promise.all([destroyAdminSession(), destroyUserSession()]);
const response = new NextResponse(null, { status: 303 });
response.headers.set("Location", "/login");
return response;
}