mirror of
https://git.moonleay.net/Websites/liljudd-website.git
synced 2025-07-24 17:55:07 +02:00
Fix: login cookies and refresh token
This commit is contained in:
parent
1b2673fc93
commit
76fa4872f1
7 changed files with 80 additions and 55 deletions
|
@ -4,15 +4,12 @@ import { appendHeader } from "vinxi/http";
|
|||
import { lucia } from "~/lib/auth";
|
||||
|
||||
export const GET = async (event: APIEvent) => {
|
||||
if (!event.nativeEvent.context.session) {
|
||||
return new Error("Unauthorized");
|
||||
}
|
||||
await lucia.invalidateSession(event.nativeEvent.context.session.id);
|
||||
appendHeader(
|
||||
event,
|
||||
"Set-Cookie",
|
||||
lucia.createBlankSessionCookie().serialize(),
|
||||
);
|
||||
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: "/" },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue