40 lines
650 B
TypeScript
40 lines
650 B
TypeScript
import { GetServerSideProps, GetStaticPaths, GetStaticProps } from 'next';
|
|
import Link from 'next/link';
|
|
|
|
type PageParams = {
|
|
id:string;
|
|
}
|
|
|
|
type PageProps = {
|
|
id:string;
|
|
}
|
|
|
|
export const getServerSideProps:GetServerSideProps<> = async ({ params }) => {
|
|
const { id } = params as PageParams;
|
|
|
|
// if(id !== '0') {
|
|
// return {
|
|
// notFound: true
|
|
// };
|
|
// }
|
|
|
|
return {
|
|
props: {
|
|
id
|
|
},
|
|
};
|
|
};
|
|
|
|
export const Page:React.FC<PageProps> = ({ id }) => {
|
|
return (
|
|
<div>
|
|
<h1>Viewing Game ID: {id}</h1>
|
|
|
|
<Link href={`/games/${id}/play`}>
|
|
Play Game
|
|
</Link>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Page; |