Prevents a 404 page for payments (#770)
This commit is contained in:
parent
63930c1817
commit
50367c236a
1 changed files with 3 additions and 7 deletions
|
@ -65,11 +65,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!rawPayment) {
|
if (!rawPayment) throw Error("Payment not found");
|
||||||
return {
|
|
||||||
notFound: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const { data, booking: _booking, ...restPayment } = rawPayment;
|
const { data, booking: _booking, ...restPayment } = rawPayment;
|
||||||
const payment = {
|
const payment = {
|
||||||
|
@ -77,7 +73,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||||
data: data as unknown as PaymentData,
|
data: data as unknown as PaymentData,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!_booking) return { notFound: true };
|
if (!_booking) throw Error("Booking not found");
|
||||||
|
|
||||||
const { startTime, eventType, ...restBooking } = _booking;
|
const { startTime, eventType, ...restBooking } = _booking;
|
||||||
const booking = {
|
const booking = {
|
||||||
|
@ -85,7 +81,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||||
startTime: startTime.toString(),
|
startTime: startTime.toString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!eventType) return { notFound: true };
|
if (!eventType) throw Error("Event not found");
|
||||||
|
|
||||||
const [user] = eventType.users;
|
const [user] = eventType.users;
|
||||||
if (!user) return { notFound: true };
|
if (!user) return { notFound: true };
|
||||||
|
|
Loading…
Reference in a new issue