Fix payload reading null error

This commit is contained in:
Mawoka
2025-10-26 12:44:04 +01:00
parent c15f8b2370
commit 7d9699541e
4 changed files with 35 additions and 31 deletions
+4
View File
@@ -13,6 +13,10 @@ export const handle: Handle = async ({ event, resolve }) => {
return resolve(event);
}
const jwt = jws.decode(access_token.replace('Bearer ', ''));
if (!jwt) {
event.locals.email = null;
return resolve(event);
}
// if token expires, do a request to get a new one and set the response-cookies on the response
if (Date.now() >= jwt.payload.exp * 1000) {
const res = await fetch(`${process.env.API_URL}/api/v1/users/check`, {
@@ -21,7 +21,7 @@ SPDX-License-Identifier: MPL-2.0
navbarVisible.visible = true;
let { data } = $props();
const { verified: boolean } = data;
let { verified } = data;
let session_data = $state({});
let step = $state(0);