fix: eventType not defined on [user]/[type]

pull/289/head
femyeda 2021-06-19 10:17:23 -05:00
parent fbc504f670
commit ad0b561cca
1 changed files with 22 additions and 18 deletions

View File

@ -389,29 +389,33 @@ export async function getServerSideProps(context) {
}
});
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) {
if (!user ) {
return {
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 {
props: {
user,