import { auth } from "@pkg/logic/domains/auth/config.base";
import type { PageServerLoad } from "./$types";
import { redirect } from "@sveltejs/kit";

export const load = (async (c) => {
    const sess = await auth.api.getSession({
        headers: c.request.headers,
    });

    if (!!sess && !!sess.user && !!sess.session) {
        return redirect(302, "/");
    }
}) satisfies PageServerLoad;
