Tldraw/apps/www/pages/r/index.tsx

28 wiersze
566 B
TypeScript
Czysty Zwykły widok Historia

import type { GetServerSideProps } from 'next'
import Head from 'next/head'
import * as React from 'react'
export default function RandomRoomPage() {
return (
<>
<Head>
2021-11-16 16:31:50 +00:00
<title>tldraw</title>
</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: {},
}
}