tldraw/www/pages/k/index.tsx
Steve Ruiz b68a4681e1
[improvement] repo shuffle (#214)
* move folders out of packages

* Remove custom yarn stuff, remove duplicate readme

* Remove stitches config

* Add README script.

* bump deps

* Fix script

* Update package.json
2021-11-02 11:46:25 +00:00

34 lines
700 B
TypeScript

import * as React from 'react'
import type { GetServerSideProps } from 'next'
import Head from 'next/head'
interface RoomProps {
id?: string
}
export default function RandomRoomPage({ id }: RoomProps): JSX.Element {
return (
<>
<Head>
<title>tldraw</title>
</Head>
<div>Should have routed to room: {id}</div>
</>
)
}
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 {
props: {
id,
},
}
}