Merge pull request #285 from emrysal/bugfix/throw-404-when-eventType-missing
This commit is contained in:
commit
440bee0a5f
1 changed files with 40 additions and 38 deletions
|
@ -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: {
|
||||
|
|
Loading…
Reference in a new issue