import type { PageServerLoad } from './$types'; import { backendFetch } from '$lib/server/scraper'; export const load: PageServerLoad = async ({ locals }) => { const userId = locals.user!.id; try { const res = await backendFetch('/api/notifications?user_id=' + userId); const data = await res.json().catch(() => ({ notifications: [] })); return { userId, notifications: (data.notifications ?? []) as Array<{id: string; title: string; message: string; link: string; read: boolean}> }; } catch { return { userId, notifications: [] }; } };