Merged in fix/polling-status-guarantee (pull request #1601)
fix: refetch data for confirmation number to avoid booking already completed * fix: refetch data for confirmation number to avoid booking already completed Approved-by: Christian Andolf
This commit is contained in:
@@ -30,14 +30,17 @@ export function useGuaranteeBooking({
|
||||
})
|
||||
)
|
||||
}, [intl])
|
||||
|
||||
const utils = trpc.useUtils()
|
||||
const guaranteeBooking = trpc.booking.guarantee.useMutation({
|
||||
onSuccess: (result) => {
|
||||
onSuccess: (result, variables) => {
|
||||
if (result) {
|
||||
if (result.reservationStatus == BookingStatusEnum.BookingCompleted) {
|
||||
handleBookingCompleted()
|
||||
} else {
|
||||
setIsPollingForBookingStatus(true)
|
||||
utils.booking.status.invalidate({
|
||||
confirmationNumber: variables.confirmationNumber,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
handlePaymentError()
|
||||
@@ -66,7 +69,7 @@ export function useGuaranteeBooking({
|
||||
} else if (bookingStatus.isTimeout) {
|
||||
handlePaymentError()
|
||||
}
|
||||
}, [bookingStatus, router, intl, handlePaymentError])
|
||||
}, [bookingStatus, router, handlePaymentError])
|
||||
|
||||
const isLoading =
|
||||
guaranteeBooking.isPending ||
|
||||
|
||||
Reference in New Issue
Block a user