fix(pages): fix session preservation on unauthenticated route

This commit is contained in:
Jörg Krzeslak
2026-10-22 16:56:13 +02:00
parent 5cdce6b4b4
commit e17f29552c
+11 -9
View File
@@ -57,19 +57,21 @@ export const root = new Elysia().use(userService).get(
});
user = { id: newUserId };
if (!auth) {
// Use existing cookie if it exists, otherwise set a new one
if (auth) {
auth.set({
value: accessToken,
httpOnly: true,
secure: !HTTP_ALLOWED,
maxAge: 24 * 60 * 60,
sameSite: "strict",
});
} else {
return {
message: "No auth cookie, perhaps your browser is blocking cookies.",
};
}
auth.set({
value: accessToken,
httpOnly: true,
secure: !HTTP_ALLOWED,
maxAge: 24 * 60 * 60,
sameSite: "strict",
});
}
} else if (auth?.value) {
user = await jwt.verify(auth.value);