tldraw/apps/www/pages/index.tsx

34 lines
778 B
TypeScript
Raw Normal View History

2021-08-10 16:12:55 +00:00
import dynamic from 'next/dynamic'
import type { GetServerSideProps } from 'next'
2021-09-04 12:02:13 +00:00
import { getSession } from 'next-auth/client'
2021-09-06 13:37:48 +00:00
import Head from 'next/head'
const Editor = dynamic(() => import('components/Editor'), { ssr: false })
2021-09-04 12:02:13 +00:00
interface PageProps {
isUser: boolean
isSponsor: boolean
}
export default function Home({ isUser, isSponsor }: PageProps): JSX.Element {
2021-09-06 13:37:48 +00:00
return (
<>
<Head>
2021-11-16 16:31:50 +00:00
<title>tldraw</title>
2021-09-06 13:37:48 +00:00
</Head>
<Editor id="home" isUser={isUser} isSponsor={isSponsor} />
2021-09-06 13:37:48 +00:00
</>
)
2021-09-04 12:02:13 +00:00
}
export const getServerSideProps: GetServerSideProps = async (context) => {
const session = await getSession(context)
return {
props: {
2021-11-19 14:33:15 +00:00
isUser: session?.user ? true : false,
isSponsor: session?.user ? true : false,
2021-09-04 12:02:13 +00:00
},
}
2021-08-10 16:12:55 +00:00
}