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])
|
}, [intl])
|
||||||
|
const utils = trpc.useUtils()
|
||||||
const guaranteeBooking = trpc.booking.guarantee.useMutation({
|
const guaranteeBooking = trpc.booking.guarantee.useMutation({
|
||||||
onSuccess: (result) => {
|
onSuccess: (result, variables) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
if (result.reservationStatus == BookingStatusEnum.BookingCompleted) {
|
if (result.reservationStatus == BookingStatusEnum.BookingCompleted) {
|
||||||
handleBookingCompleted()
|
handleBookingCompleted()
|
||||||
} else {
|
} else {
|
||||||
setIsPollingForBookingStatus(true)
|
setIsPollingForBookingStatus(true)
|
||||||
|
utils.booking.status.invalidate({
|
||||||
|
confirmationNumber: variables.confirmationNumber,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
handlePaymentError()
|
handlePaymentError()
|
||||||
@@ -66,7 +69,7 @@ export function useGuaranteeBooking({
|
|||||||
} else if (bookingStatus.isTimeout) {
|
} else if (bookingStatus.isTimeout) {
|
||||||
handlePaymentError()
|
handlePaymentError()
|
||||||
}
|
}
|
||||||
}, [bookingStatus, router, intl, handlePaymentError])
|
}, [bookingStatus, router, handlePaymentError])
|
||||||
|
|
||||||
const isLoading =
|
const isLoading =
|
||||||
guaranteeBooking.isPending ||
|
guaranteeBooking.isPending ||
|
||||||
|
|||||||
Reference in New Issue
Block a user