import { browser } from '$app/environment'; import { goto } from '$app/navigation'; import { getAccessToken } from '$lib/services/api'; import type { LayoutLoad } from './$types'; export const load: LayoutLoad = async () => { // Check authentication on client side using localStorage (source of truth) if (browser) { const token = getAccessToken(); if (!token) { goto('/login'); return { authenticated: false }; } } return { authenticated: true }; };