diff --git a/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts b/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts index 56097f778..323407632 100644 --- a/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts +++ b/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts @@ -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 ||