-
Notifications
You must be signed in to change notification settings - Fork 1
/
no_sidebar.tsx
46 lines (38 loc) · 1.02 KB
/
no_sidebar.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import type { GetServerSidePropsContext } from 'next';
import Head from 'next/head';
import { getServerSession } from 'next-auth/next';
import Typography from '@mui/material/Typography';
import { SidebarType } from '~/components/Layout';
import type { AppPage, SessionUser } from '~/types';
import { authOptions } from '~/pages/api/auth/[...nextauth]';
const ExamplePage: AppPage = () => {
return (
<main>
<Head>
<title>No Sidebar - Examples</title>
</Head>
<Typography variant="h3" component="h2">
No sidebar example
</Typography>
</main>
);
};
ExamplePage.layout = {
sidebar: {
type: SidebarType.NONE,
},
};
export async function getServerSideProps(context: GetServerSidePropsContext) {
const session = await getServerSession(context.req, context.res, authOptions);
if (!session || !session.user) {
return { notFound: true };
}
const user = session.user as SessionUser;
return {
props: {
session,
user,
},
};
}
export default ExamplePage;