Revert "Fixed cancellation bug: "cannot read property 'length' of null""

pull/288/head
Femi Odugbesan 2021-06-19 09:14:24 -05:00 committed by GitHub
parent 11fc0f0d2a
commit de4c8f75e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 11 deletions

View File

@ -134,6 +134,38 @@ export default function Type(props) {
}
export async function getServerSideProps(context) {
const user = await prisma.user.findFirst({
where: {
username: context.query.user,
},
select: {
id: true,
username: true,
name: true,
}
});
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
}
});
const booking = await prisma.booking.findFirst({
where: {
uid: context.query.uid,
@ -144,15 +176,7 @@ export async function getServerSideProps(context) {
description: true,
startTime: true,
endTime: true,
attendees: true,
eventType: true,
user: {
select: {
id: true,
username: true,
name: true,
}
}
attendees: true
}
});
@ -164,8 +188,8 @@ export async function getServerSideProps(context) {
return {
props: {
user: booking.user,
eventType: booking.eventType,
user,
eventType,
booking: bookingObj
},
}