Invalid Payment URL gives 500 (#2857)
Co-authored-by: gitstart <gitstart@users.noreply.github.com> Co-authored-by: Júlio Piubello da Silva Cabral <julio.piubello@gitstart.dev>
This commit is contained in:
co-authored by
gitstart
Júlio Piubello da Silva Cabral
parent
6145c7ad90
commit
7c34be272f
@@ -66,7 +66,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||
},
|
||||
});
|
||||
|
||||
if (!rawPayment) throw Error("Payment not found");
|
||||
if (!rawPayment) return { notFound: true };
|
||||
|
||||
const { data, booking: _booking, ...restPayment } = rawPayment;
|
||||
const payment = {
|
||||
@@ -74,7 +74,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||
data: data as unknown as PaymentData,
|
||||
};
|
||||
|
||||
if (!_booking) throw Error("Booking not found");
|
||||
if (!_booking) return { notFound: true };
|
||||
|
||||
const { startTime, eventType, ...restBooking } = _booking;
|
||||
const booking = {
|
||||
@@ -82,7 +82,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||
startTime: startTime.toString(),
|
||||
};
|
||||
|
||||
if (!eventType) throw Error("Event not found");
|
||||
if (!eventType) return { notFound: true };
|
||||
|
||||
const [user] = eventType.users;
|
||||
if (!user) return { notFound: true };
|
||||
|
||||
Reference in New Issue
Block a user