Fix: Update beer style page to send error 404

This commit is contained in:
Aaron William Po
2023-10-30 00:46:17 -04:00
parent 3374aec59a
commit 67debcef81

View File

@@ -65,6 +65,9 @@ export default BeerStyleByIdPage;
export const getServerSideProps: GetServerSideProps = async ({ params }) => { export const getServerSideProps: GetServerSideProps = async ({ params }) => {
const id = params!.id as string; const id = params!.id as string;
const beerStyle = await getBeerStyleById(id); const beerStyle = await getBeerStyleById(id);
if (!beerStyle) {
return { notFound: true };
}
return { props: { beerStyle: JSON.parse(JSON.stringify(beerStyle)) } }; return { props: { beerStyle: JSON.parse(JSON.stringify(beerStyle)) } };
}; };