Booking success query refactor (#5298)
* Booking succes query refactor The query is now using the uid as its main identifier for the success page * Minor changes to the succes.tsx and tests * Convert eventtype dates to string, and only select eventtype slug from db to have a smaller query (we don't need more data, and this way we don't need to convert the dates in here to smaller strings either.) * In the payment component get the bookingUid from props instead of the query * Changed the recurringMutation to use the uid for the success booking page Co-authored-by: alannnc <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Jeroen Reumkens <[email protected]> Co-authored-by: Hariom Balhara <[email protected]> Co-authored-by: zomars <[email protected]> Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
9 files changed
+94
-145
No files matched your search
@@ -510,6 +510,7 @@ async function handler(req: NextApiRequest & { userId?: number | undefined }) {
|
||||
uid: reqBody.bookingUid,
|
||||
},
|
||||
select: {
|
||||
uid: true,
|
||||
id: true,
|
||||
attendees: true,
|
||||
userId: true,
|
||||
|
||||
@@ -36,6 +36,7 @@ type Props = {
|
||||
user: { username: string | null };
|
||||
location?: string | null;
|
||||
bookingId: number;
|
||||
bookingUid: string;
|
||||
};
|
||||
|
||||
type States =
|
||||
@@ -47,7 +48,6 @@ type States =
|
||||
export default function PaymentComponent(props: Props) {
|
||||
const { t, i18n } = useLocale();
|
||||
const router = useRouter();
|
||||
const { email, name, date } = router.query;
|
||||
const [state, setState] = useState<States>({ status: "idle" });
|
||||
const stripe = useStripe();
|
||||
const elements = useElements();
|
||||
@@ -83,12 +83,7 @@ export default function PaymentComponent(props: Props) {
|
||||
});
|
||||
} else {
|
||||
const params: { [k: string]: any } = {
|
||||
date,
|
||||
type: props.eventType.id,
|
||||
username: props.user.username,
|
||||
email,
|
||||
name,
|
||||
bookingId: props.bookingId,
|
||||
uid: props.bookingUid,
|
||||
};
|
||||
|
||||
if (props.location) {
|
||||
|
||||
@@ -136,6 +136,7 @@ const PaymentPage: FC<PaymentPageProps> = (props) => {
|
||||
user={props.user}
|
||||
location={props.booking.location}
|
||||
bookingId={props.booking.id}
|
||||
bookingUid={props.booking.uid}
|
||||
/>
|
||||
</Elements>
|
||||
)}
|
||||
|
||||
@@ -31,6 +31,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||
booking: {
|
||||
select: {
|
||||
id: true,
|
||||
uid: true,
|
||||
description: true,
|
||||
title: true,
|
||||
startTime: true,
|
||||
|
||||
Reference in new issue
Block a user