If booking doesnt exist its 404 page but if it exists and eventType doesnt exist, log it for now and continue with the flow (#3202)

pull/3020/head
Hariom Balhara 2022-06-30 15:09:15 +00:00 committed by GitHub
parent 1469b856a6
commit eef405ef41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -38,7 +38,19 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
},
});
const dynamicEventSlugRef = booking?.dynamicEventSlugRef || "";
if (!booking?.eventType && !booking?.dynamicEventSlugRef) throw Error("This booking doesn't exists");
if (!booking) {
return {
notFound: true,
};
}
if (!booking?.eventType && !booking?.dynamicEventSlugRef) {
// TODO: Show something in UI to let user know that this booking is not rescheduleable.
return {
notFound: true,
};
}
const eventType = booking.eventType ? booking.eventType : getDefaultEvent(dynamicEventSlugRef);