Merge pull request #289 from femyeda/hotfix/500-on-type-page
fix: eventType not defined on [user]/[type]
This commit is contained in:
commit
6d7ec7fa66
1 changed files with 22 additions and 18 deletions
|
@ -389,29 +389,33 @@ export async function getServerSideProps(context) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (user) {
|
if (!user ) {
|
||||||
const eventType = await prisma.eventType.findFirst({
|
|
||||||
where: {
|
|
||||||
userId: user.id,
|
|
||||||
slug: {
|
|
||||||
equals: context.query.type,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
title: true,
|
|
||||||
description: true,
|
|
||||||
length: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!user || !eventType) {
|
|
||||||
return {
|
return {
|
||||||
notFound: true,
|
notFound: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const eventType = await prisma.eventType.findFirst({
|
||||||
|
where: {
|
||||||
|
userId: user.id,
|
||||||
|
slug: {
|
||||||
|
equals: context.query.type,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
description: true,
|
||||||
|
length: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!eventType) {
|
||||||
|
return {
|
||||||
|
notFound: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
user,
|
user,
|
||||||
|
|
Loading…
Reference in a new issue