add: Subscriptions receival
This commit is contained in:
@@ -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];
|
||||||
|
|||||||
@@ -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 };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user