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

export const load: LayoutServerLoad = async ({ locals, parent }) => {
	if (!locals.member) {
		throw redirect(303, '/login');
	}

	const parentData = await parent();

	return {
		member: locals.member,
		pakaiStok: parentData.pakaiStok ?? false
	};
};
