set data.user in a way that works

This commit is contained in:
Erin 2023-11-12 17:49:51 -05:00
parent 0be14731f0
commit 3f65988c16

View file

@ -4,7 +4,12 @@ import {getUserFromSessionID} from '$lib/server/sessionutil';
import type {LayoutServerLoad} from './$types'; import type {LayoutServerLoad} from './$types';
export const load: LayoutServerLoad = async ({cookies}) => { export const load: LayoutServerLoad = async ({cookies}) => {
return JSON.parse(JSON.stringify({ const user = await getUserFromSessionID(cookies.get(Cookie.SESSION_ID));
user: await getUserFromSessionID(cookies.get(Cookie.SESSION_ID)), return {
})); user: user && {
id: user?.id,
createdAt: user?.createdAt,
name: user?.name,
},
};
}; };