File size: 339 Bytes
3d330e9
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import type { LayoutServerLoad } from './$types';
import { error, redirect } from '@sveltejs/kit';

export const load: LayoutServerLoad = (event) => {
	if (!event.locals.user) {
		throw redirect(303, `/connexion?suivant=${encodeURIComponent(event.url.href)}`);
	}

	if (event.locals.user.authority !== 'admin') {
		throw error(403);
	}
};