import type { LayoutServerLoad } from './$types'; import { redirect } from '@sveltejs/kit'; export const load: LayoutServerLoad = async (event) => { const userId = event.locals.userId ?? null; if (!userId) { throw redirect(303, '/login'); } return { userId }; };