2021-06-28 20:45:06 +00:00
|
|
|
import { GetServerSideProps } from 'next'
|
|
|
|
import { getSession } from 'next-auth/client'
|
2021-07-13 20:26:16 +00:00
|
|
|
import { uniqueId } from 'utils'
|
2021-06-28 20:45:06 +00:00
|
|
|
|
2021-06-29 12:12:30 +00:00
|
|
|
export default function CreateNewRoom(): JSX.Element {
|
2021-06-28 20:45:06 +00:00
|
|
|
return <div>You should not see this one</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
export const getServerSideProps: GetServerSideProps = async (context) => {
|
|
|
|
const session = await getSession(context)
|
|
|
|
|
|
|
|
if (!session?.user) {
|
|
|
|
context.res.setHeader('Location', `/sponsorware`)
|
|
|
|
context.res.statusCode = 307
|
|
|
|
}
|
|
|
|
|
2021-07-13 20:26:16 +00:00
|
|
|
context.res.setHeader('Location', `/room/${uniqueId()}`)
|
2021-06-28 20:45:06 +00:00
|
|
|
context.res.statusCode = 307
|
|
|
|
|
|
|
|
return {
|
|
|
|
props: {},
|
|
|
|
}
|
|
|
|
}
|