import {User} from "@/interfaces/user";
import {sessionOptions} from "@/lib/session";
import { redirect } from "@/utils";
import { requestUser } from "@/utils/api";
import {withIronSessionSsr} from "iron-session/next";

export const getServerSideProps = withIronSessionSsr(async ({req, res}) => {
	const user = await requestUser(req, res)
	if (!user) return redirect("/login")

	return redirect(`/dashboard/${user.type}`)
}, sessionOptions);

export default function Dashboard() {
	return <div></div>;
}
