set data.user in a way that works
This commit is contained in:
parent
0be14731f0
commit
3f65988c16
|
@ -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,
|
||||||
|
},
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue