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