| 1234567891011121314151617181920 |
- import { destroySession } from "@/lib/auth/session";
- import { withErrorHandling, json } from "@/lib/api/errors";
- /**
- * GET /api/auth/logout
- *
- * Destroys the current session by clearing the auth cookie.
- * Always returns { ok: true } on success.
- *
- * Note:
- * - This endpoint is intentionally idempotent.
- * - If there is no cookie, destroySession() still sets an empty cookie.
- */
- export const GET = withErrorHandling(
- async function GET() {
- await destroySession();
- return json({ ok: true }, 200);
- },
- { logPrefix: "[api/auth/logout]" }
- );
|