import { redirect } from '@sveltejs/kit' import type { PageServerLoad } from './$types' export const load: PageServerLoad = async ({ locals }) => { // Enforce authorization at individual page level if (!locals.session.isAuthenticated) { throw redirect(302, '/auth/login') } const role = locals.session.account?.role ?? 0 if (role < 7) { throw redirect(302, '/') } return {} }