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