Merged in fix/SW-3283-select-rate-booking-code (pull request #2699)
fix(SW-3283): add booking code when selecting rate and reset state when removing booking code * fix(SW-3283): add booking code when selecting rate and reset state when removing booking code * feat: add removeBookingCode action to SelectRateContext * fix(SW-3283): add booking code when selecting rate and reset state when removing booking code * fix(SW-3283): merge Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -454,6 +454,24 @@ export function SelectRateProvider({
|
||||
updateBooking(selectRateBooking)
|
||||
setActiveRoomIndex("next")
|
||||
},
|
||||
removeBookingCode: () => {
|
||||
if (!selectRateInput.data) {
|
||||
return
|
||||
}
|
||||
|
||||
const clearedBooking: SelectRateBooking = {
|
||||
hotelId: selectRateInput.data.booking.hotelId,
|
||||
fromDate: selectRateInput.data.booking.fromDate,
|
||||
toDate: selectRateInput.data.booking.toDate,
|
||||
rooms: selectRateInput.data.booking.rooms.map((room) => ({
|
||||
...room,
|
||||
bookingCode: null,
|
||||
})),
|
||||
}
|
||||
|
||||
updateBooking(clearedBooking)
|
||||
setActiveRoomIndex(0)
|
||||
},
|
||||
},
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -73,6 +73,7 @@ export type SelectRateContext = {
|
||||
roomTypeCode: string
|
||||
bookingCode?: string
|
||||
}) => void
|
||||
removeBookingCode: () => void
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user