memorium/routes/api/auth/logout.ts

18 lines
394 B
TypeScript
Raw Normal View History

2023-08-04 22:35:25 +02:00
import { deleteCookie } from "https://deno.land/std@0.197.0/http/cookie.ts";
import { Handlers } from "$fresh/server.ts";
export const handler: Handlers = {
GET() {
const headers = new Headers();
headers.append("location", "/");
deleteCookie(headers, "session_cookie", {
path: "/",
});
return new Response(null, {
headers,
status: 302,
});
},
};