Merged in revert-pr-1925 (pull request #1927)
Revert "Feat/sw 2323 find booking (pull request #1925)" Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -57,7 +57,7 @@ export default function FinalConfirmation({
|
||||
)
|
||||
} else {
|
||||
const cancelledRooms = rooms.filter((r) =>
|
||||
variables.refIds.includes(r.refId)
|
||||
variables.confirmationNumbers.includes(r.confirmationNumber)
|
||||
)
|
||||
for (const cancelledRoom of cancelledRooms) {
|
||||
toast.success(
|
||||
@@ -93,16 +93,13 @@ export default function FinalConfirmation({
|
||||
)
|
||||
}
|
||||
|
||||
utils.booking.confirmation.invalidate({
|
||||
refId: bookedRoom.refId,
|
||||
lang,
|
||||
utils.booking.get.invalidate({
|
||||
confirmationNumber: bookedRoom.confirmationNumber,
|
||||
})
|
||||
|
||||
utils.booking.linkedReservations.invalidate({
|
||||
refId: bookedRoom.refId,
|
||||
lang,
|
||||
rooms: bookedRoom.linkedReservations,
|
||||
})
|
||||
|
||||
closeModal()
|
||||
},
|
||||
onError() {
|
||||
@@ -116,13 +113,13 @@ export default function FinalConfirmation({
|
||||
|
||||
function cancelBooking() {
|
||||
if (Array.isArray(formRooms)) {
|
||||
const refIdsToCancel = formRooms
|
||||
const confirmationNumbersToCancel = formRooms
|
||||
.filter((r) => r.checked)
|
||||
.map((r) => r.confirmationNumber)
|
||||
if (refIdsToCancel.length) {
|
||||
if (confirmationNumbersToCancel.length) {
|
||||
cancelBookingsMutation.mutate({
|
||||
refIds: refIdsToCancel,
|
||||
lang,
|
||||
confirmationNumbers: confirmationNumbersToCancel,
|
||||
language: lang,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -54,10 +54,10 @@ export default function Confirmation({
|
||||
)
|
||||
|
||||
const updateBooking = trpc.booking.update.useMutation({
|
||||
onSuccess: (refId) => {
|
||||
if (refId) {
|
||||
utils.booking.confirmation.invalidate({
|
||||
refId,
|
||||
onSuccess: (updatedBooking) => {
|
||||
if (updatedBooking) {
|
||||
utils.booking.get.invalidate({
|
||||
confirmationNumber: updatedBooking.confirmationNumber,
|
||||
})
|
||||
|
||||
toast.success(
|
||||
@@ -86,7 +86,7 @@ export default function Confirmation({
|
||||
|
||||
function handleModifyStay() {
|
||||
updateBooking.mutate({
|
||||
refId: bookedRoom.refId,
|
||||
confirmationNumber: bookedRoom.confirmationNumber,
|
||||
checkInDate,
|
||||
checkOutDate,
|
||||
})
|
||||
|
||||
@@ -60,7 +60,7 @@ export default function Form() {
|
||||
const guaranteeRedirectUrl = `${env.NEXT_PUBLIC_NODE_ENV === "development" ? `http://localhost:${env.NEXT_PUBLIC_PORT}` : ""}${guaranteeCallback(lang)}`
|
||||
|
||||
const { guaranteeBooking, isLoading, handleGuaranteeError } =
|
||||
useGuaranteeBooking(refId, false, hotelId)
|
||||
useGuaranteeBooking(confirmationNumber, false, hotelId)
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
@@ -85,7 +85,7 @@ export default function Form() {
|
||||
: undefined
|
||||
writeGlaToSessionStorage("yes", hotelId)
|
||||
guaranteeBooking.mutate({
|
||||
refId,
|
||||
confirmationNumber,
|
||||
language: lang,
|
||||
...(card && { card }),
|
||||
success: `${guaranteeRedirectUrl}?status=success&RefId=${encodeURIComponent(refId)}`,
|
||||
|
||||
Reference in New Issue
Block a user