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

This commit is contained in:
femyeda 2021-06-19 10:17:23 -05:00
parent fbc504f670
commit ad0b561cca

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,