2021-06-03 16:13:23 +00:00
|
|
|
import Head from 'next/head'
|
|
|
|
import dynamic from 'next/dynamic'
|
2021-06-20 12:35:47 +00:00
|
|
|
import { GetServerSideProps } from 'next'
|
|
|
|
import { getSession } from 'next-auth/client'
|
|
|
|
|
2021-06-03 16:13:23 +00:00
|
|
|
const Editor = dynamic(() => import('components/editor'), { ssr: false })
|
2021-05-09 12:03:39 +00:00
|
|
|
|
2021-06-21 21:35:28 +00:00
|
|
|
export default function Home(): JSX.Element {
|
2021-05-09 13:04:42 +00:00
|
|
|
return (
|
2021-06-03 16:13:23 +00:00
|
|
|
<>
|
|
|
|
<Head>
|
|
|
|
<title>tldraw</title>
|
|
|
|
</Head>
|
2021-05-09 13:04:42 +00:00
|
|
|
<Editor />
|
2021-06-03 16:13:23 +00:00
|
|
|
</>
|
2021-05-09 13:04:42 +00:00
|
|
|
)
|
2021-05-09 12:03:39 +00:00
|
|
|
}
|
2021-06-20 12:35:47 +00:00
|
|
|
|
|
|
|
export const getServerSideProps: GetServerSideProps = async (context) => {
|
|
|
|
const session = await getSession(context)
|
|
|
|
|
|
|
|
if (!session?.user) {
|
|
|
|
context.res.setHeader('Location', `/sponsorware`)
|
|
|
|
context.res.statusCode = 307
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
props: {
|
|
|
|
session,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|