diff --git a/components/HotelReservation/SelectRate/Payment/index.tsx b/components/HotelReservation/SelectRate/Payment/index.tsx index 979b4c95c..b1bddd84c 100644 --- a/components/HotelReservation/SelectRate/Payment/index.tsx +++ b/components/HotelReservation/SelectRate/Payment/index.tsx @@ -58,11 +58,6 @@ export default function Payment({ hotel }: PaymentProps) { const initiateBooking = trpc.booking.booking.create.useMutation({ onSuccess: (result) => { if (result?.confirmationNumber) { - // Planet doesn't support query params so we have to store values in session storage - sessionStorage.setItem( - BOOKING_CONFIRMATION_NUMBER, - result.confirmationNumber - ) setConfirmationNumber(result.confirmationNumber) } else { // TODO: add proper error message @@ -85,6 +80,8 @@ export default function Payment({ hotel }: PaymentProps) { useEffect(() => { if (confirmationNumber && bookingStatus?.data?.paymentUrl) { + // Planet doesn't support query params so we have to store values in session storage + sessionStorage.setItem(BOOKING_CONFIRMATION_NUMBER, confirmationNumber) router.push(bookingStatus.data.paymentUrl) } }, [confirmationNumber, bookingStatus, router])