tldraw/pages/index.tsx

33 lines
669 B
TypeScript
Raw Normal View History

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'
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 (
<>
<Head>
<title>tldraw</title>
</Head>
2021-05-09 13:04:42 +00:00
<Editor />
</>
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,
},
}
}