Merge pull request #285 from emrysal/bugfix/throw-404-when-eventType-missing

pull/288/head
Bailey Pumfleet 2021-06-18 23:35:42 +01:00 committed by GitHub
commit 440bee0a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 40 additions and 38 deletions

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: {