frontend/pages/index.tsx (view raw)
1import {getSession} from 'next-auth/react';
2
3const IndexPage = () => null;
4
5export const getServerSideProps = async context => {
6 const session = await getSession(context);
7
8 if (session)
9 return {
10 redirect: {
11 destination: '/dashboard',
12 permanent: false,
13 },
14 };
15 else
16 return {
17 redirect: {
18 destination: '/new',
19 permanent: false,
20 },
21 };
22};
23
24export default IndexPage;