Prevents a 404 page for payments (#770)

pull/762/head
Omar López 2021-09-24 10:45:35 -06:00 committed by GitHub
parent 63930c1817
commit 50367c236a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -65,11 +65,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
},
});
if (!rawPayment) {
return {
notFound: true,
};
}
if (!rawPayment) throw Error("Payment not found");
const { data, booking: _booking, ...restPayment } = rawPayment;
const payment = {
@ -77,7 +73,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
data: data as unknown as PaymentData,
};
if (!_booking) return { notFound: true };
if (!_booking) throw Error("Booking not found");
const { startTime, eventType, ...restBooking } = _booking;
const booking = {
@ -85,7 +81,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
startTime: startTime.toString(),
};
if (!eventType) return { notFound: true };
if (!eventType) throw Error("Event not found");
const [user] = eventType.users;
if (!user) return { notFound: true };