mirror of
https://git.moonleay.net/Websites/liljudd-website.git
synced 2025-07-23 09:15:07 +02:00
17 lines
539 B
TypeScript
17 lines
539 B
TypeScript
import { APIEvent } from "@solidjs/start/server";
|
|
import httpStatus from "http-status";
|
|
import { appendHeader } from "vinxi/http";
|
|
import { lucia } from "~/lib/auth";
|
|
|
|
export const GET = async (event: APIEvent) => {
|
|
const { session } = event.nativeEvent.context;
|
|
|
|
if (!session) return new Error("Unauthorized");
|
|
|
|
await lucia.invalidateSession(session.id);
|
|
appendHeader("Set-Cookie", lucia.createBlankSessionCookie().serialize());
|
|
return new Response(null, {
|
|
status: httpStatus.FOUND,
|
|
headers: { Location: "/" },
|
|
});
|
|
};
|