import { redirect } from '@sveltejs/kit';
import type { LayoutServerLoad } from './$types';

export const load: LayoutServerLoad = async ({ parent }) => {
	const { member } = await parent();

	// Only admins can access admin pages
	if (member?.role !== 'admin') {
		throw redirect(303, '/dashboard');
	}

	return {};
};
