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

export const load: PageServerLoad = async ({ locals }) => {
	const { session } = await locals.safeGetSession();

	// If logged in, go to dashboard; otherwise go to login
	if (session) {
		throw redirect(303, '/dashboard');
	} else {
		throw redirect(303, '/login');
	}
};
