2021-10-08 23:05:24 +00:00
|
|
|
import * as React from 'react'
|
|
|
|
import type { GetServerSideProps } from 'next'
|
|
|
|
import Head from 'next/head'
|
|
|
|
|
2022-05-14 13:15:55 +00:00
|
|
|
export default function RandomRoomPage() {
|
2021-10-08 23:05:24 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Head>
|
2021-11-16 16:31:50 +00:00
|
|
|
<title>tldraw</title>
|
2021-10-08 23:05:24 +00:00
|
|
|
</Head>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export const getServerSideProps: GetServerSideProps = async (context) => {
|
|
|
|
// Generate random id
|
|
|
|
const id = Date.now().toString()
|
|
|
|
|
|
|
|
// Route to a room with that id
|
|
|
|
context.res.setHeader('Location', `/r/${id}`)
|
|
|
|
context.res.statusCode = 307
|
|
|
|
|
|
|
|
// Return id (though it shouldn't matter)
|
|
|
|
return {
|
2021-11-17 12:04:06 +00:00
|
|
|
props: {},
|
2021-10-08 23:05:24 +00:00
|
|
|
}
|
|
|
|
}
|