add: Subscriptions receival

This commit is contained in:
Alex
2024-09-29 21:26:48 +02:00
parent 8e9eb22cb0
commit f7c1ad2b8e
3 changed files with 6 additions and 4 deletions

View File

@@ -27,7 +27,7 @@ export async function handle({ event, resolve }) {
} }
// find the user based on the jwt // find the user based on the jwt
const userData = await response.json(); const data = await response.json();
// Check if the server sent a new token // Check if the server sent a new token
const newToken = response.headers.get("Set-Cookie"); const newToken = response.headers.get("Set-Cookie");
@@ -44,7 +44,8 @@ export async function handle({ event, resolve }) {
} }
} }
event.locals.user = userData; event.locals.subscriptions = data.subscriptions;
event.locals.user = data.user;
if (event.locals.user.date_of_birth) { if (event.locals.user.date_of_birth) {
event.locals.user.date_of_birth = event.locals.user.date_of_birth =
event.locals.user.date_of_birth.split("T")[0]; event.locals.user.date_of_birth.split("T")[0];

View File

@@ -1,5 +1,5 @@
/** @type {import('./$types').LayoutLoad} */ /** @type {import('./$types').LayoutLoad} */
export async function load({ fetch, url, data }) { export async function load({ fetch, url, data }) {
const { user } = data; const { user, subscriptions } = data;
return { fetch, url: url.pathname, user }; return { fetch, url: url.pathname, user, subscriptions };
} }

View File

@@ -2,5 +2,6 @@
export async function load({ locals }) { export async function load({ locals }) {
return { return {
user: locals.user, user: locals.user,
subscriptions: locals.subscriptions,
}; };
} }