Return 404 when requesting event url that does not exist

This commit is contained in:
Alex van Andel 2021-06-18 20:41:12 +00:00
parent aed5af0f5e
commit cc1b3fa7dd

View file

@ -389,12 +389,7 @@ export async function getServerSideProps(context) {
} }
}); });
if (!user) { if (user) {
return {
notFound: true,
}
}
const eventType = await prisma.eventType.findFirst({ const eventType = await prisma.eventType.findFirst({
where: { where: {
userId: user.id, userId: user.id,
@ -409,6 +404,13 @@ export async function getServerSideProps(context) {
length: true length: true
} }
}); });
}
if (!user || !eventType) {
return {
notFound: true,
}
}
return { return {
props: { props: {