2025-09-26 12:06:59 -04:00
|
|
|
// app/api/auth/logout/route.ts
|
2025-09-26 11:46:01 -04:00
|
|
|
import { NextRequest, NextResponse } from "next/server";
|
|
|
|
|
|
2025-09-26 12:06:59 -04:00
|
|
|
export const runtime = "nodejs";
|
|
|
|
|
|
2025-09-27 14:30:16 -04:00
|
|
|
const secure = process.env.NODE_ENV === "production";
|
|
|
|
|
|
2025-09-26 11:46:01 -04:00
|
|
|
export async function POST(_req: NextRequest) {
|
2025-09-26 12:06:59 -04:00
|
|
|
const res = NextResponse.json({ ok: true });
|
2025-09-27 14:30:16 -04:00
|
|
|
|
|
|
|
|
res.cookies.set({
|
|
|
|
|
name: "ma_at",
|
|
|
|
|
value: "",
|
|
|
|
|
httpOnly: true,
|
|
|
|
|
sameSite: "lax",
|
|
|
|
|
secure,
|
|
|
|
|
path: "/",
|
|
|
|
|
expires: new Date(0), // expire immediately
|
|
|
|
|
maxAge: 0,
|
|
|
|
|
});
|
|
|
|
|
|
2025-09-26 11:46:01 -04:00
|
|
|
return res;
|
|
|
|
|
}
|
2025-09-27 14:30:16 -04:00
|
|
|
|
|
|
|
|
// Optional: support GET if you ever link to /api/auth/logout directly
|
|
|
|
|
export async function GET(_req: NextRequest) {
|
|
|
|
|
return POST(_req);
|
|
|
|
|
}
|