tldraw/www/pages/index.tsx

33 lines
721 B
TypeScript
Raw Normal View History

2021-08-10 16:12:55 +00:00
import dynamic from 'next/dynamic'
2021-09-04 12:02:13 +00:00
import { GetServerSideProps } from 'next'
import { getSession } from 'next-auth/client'
2021-09-06 13:37:48 +00:00
import Head from 'next/head'
2021-09-04 12:02:13 +00:00
const Editor = dynamic(() => import('components/editor'), { ssr: false })
export default function Shhh(): JSX.Element {
2021-09-06 13:37:48 +00:00
return (
<>
<Head>
<title>tldraw</title>
</Head>
<Editor id="home" />
</>
)
2021-09-04 12:02:13 +00:00
}
export const getServerSideProps: GetServerSideProps = async (context) => {
const session = await getSession(context)
if (!session?.user && process.env.NODE_ENV !== 'development') {
context.res.setHeader('Location', `/sponsorware`)
context.res.statusCode = 307
}
return {
props: {
session,
},
}
2021-08-10 16:12:55 +00:00
}