Files
memorium/routes/api/auth/logout.ts
2026-01-10 13:03:29 +01:00

24 lines
530 B
TypeScript

import { deleteCookie } from "@std/http/cookie";
import { define } from "../../../utils.ts";
export const handler = define.handlers({
GET(ctx) {
const req = ctx.req;
const url = new URL(req.url);
const redirect = decodeURIComponent(url.searchParams.get("redirect") || "");
const headers = new Headers();
headers.append("location", redirect || "/");
deleteCookie(headers, "session_cookie", {
path: "/",
});
return new Response(null, {
headers,
status: 302,
});
},
});