import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
import { getAllPaket } from '$lib/server/langganan';
import { getLandingContent } from '$lib/server/landing';

export const load: PageServerLoad = async ({ locals }) => {
	if (locals.member) {
		throw redirect(303, '/dashboard');
	}

	const [paketList, landing] = await Promise.all([getAllPaket(true), getLandingContent()]);
	return { paketList, landing };
};
