feat: add authentication
This commit is contained in:
17
routes/api/auth/logout.ts
Normal file
17
routes/api/auth/logout.ts
Normal file
@ -0,0 +1,17 @@
|
||||
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,
|
||||
});
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user