import { getCustomerInfoUseCases } from "$lib/domains/customerinfo/usecases";
import { redirect } from "@sveltejs/kit";
import type { PageServerLoad } from "./$types";

export const load: PageServerLoad = async ({ locals }) => {
	const sess = locals.session;
	if (!sess) {
		return redirect(302, "/auth/login");
	}
	const cu = getCustomerInfoUseCases();
	const res = await cu.getAllCustomerInfo();
	return { data: res.data ?? [], error: res.error };
};
