2022-08-24 21:10:48 -07:00
|
|
|
import type { LayoutServerLoad } from './$types';
|
|
|
|
|
|
2023-02-24 21:42:20 +01:00
|
|
|
export const load = (async ({ locals: { api } }) => {
|
2022-08-26 11:30:45 -07:00
|
|
|
try {
|
2023-02-23 03:49:13 +01:00
|
|
|
const { data: user } = await api.userApi.getMyUserInfo();
|
2022-08-24 21:10:48 -07:00
|
|
|
|
2023-02-17 17:37:26 +01:00
|
|
|
return { user };
|
2022-08-26 11:30:45 -07:00
|
|
|
} catch (e) {
|
2023-02-15 13:09:28 -06:00
|
|
|
console.error('[ERROR] layout.server.ts [LayoutServerLoad]: ');
|
2023-02-17 17:37:26 +01:00
|
|
|
return { user: undefined };
|
2022-08-24 21:10:48 -07:00
|
|
|
}
|
2023-02-17 17:37:26 +01:00
|
|
|
}) satisfies LayoutServerLoad;
|