Continued creating the entity system
This commit is contained in:
27
src/pages/dashboard/index.tsx
Normal file
27
src/pages/dashboard/index.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import {User} from "@/interfaces/user";
|
||||
import {sessionOptions} from "@/lib/session";
|
||||
import {withIronSessionSsr} from "iron-session/next";
|
||||
|
||||
export const getServerSideProps = withIronSessionSsr(async ({req, res}) => {
|
||||
const user = req.session.user as User | undefined;
|
||||
|
||||
if (!user) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/login",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
redirect: {
|
||||
destination: `/dashboard/${user.type}`,
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
}, sessionOptions);
|
||||
|
||||
export default function Dashboard() {
|
||||
return <div></div>;
|
||||
}
|
||||
Reference in New Issue
Block a user