diff --git a/components/HotelReservation/SelectRate/RoomSelection/index.tsx b/components/HotelReservation/SelectRate/RoomSelection/index.tsx index 2eefefe85..efa7f2b3f 100644 --- a/components/HotelReservation/SelectRate/RoomSelection/index.tsx +++ b/components/HotelReservation/SelectRate/RoomSelection/index.tsx @@ -26,35 +26,21 @@ export default function RoomSelection({ e.preventDefault() const searchParamsObject = getHotelReservationQueryParams(searchParams) - /** - * These are the query params that are used on current web and should come from the Booking Widget Search Submit. - * Might need to be changed when Search Submit in the Booking Widget is implemented. - */ const queryParams = new URLSearchParams(searchParams) searchParamsObject.room.forEach((item, index) => { - queryParams.set(`room[${index}].adults`, item.adults.toString()) - - if (Array.isArray(item.child)) { - item.child.forEach((child, childIndex) => { - queryParams.set( - `room[${index}].child[${childIndex}].age`, - child.age.toString() - ) - queryParams.set(`room[${index}].child[${childIndex}].bed`, child.bed) - }) + if (rateSummary?.roomTypeCode) { + queryParams.set(`room[${index}].roomtype`, rateSummary.roomTypeCode) + } + if (rateSummary?.public?.rateCode) { + queryParams.set(`room[${index}].ratecode`, rateSummary.public.rateCode) + } + if (rateSummary?.member?.rateCode) { + queryParams.set( + `room[${index}].counterratecode`, + rateSummary.member.rateCode + ) } - - queryParams.set( - `room[${index}].roomtypecode`, - rateSummary?.roomTypeCode || "" - ) - queryParams.set( - `room[${index}].ratecode`, - isUserLoggedIn - ? rateSummary?.member?.rateCode || "" - : rateSummary?.public?.rateCode || "" - ) }) router.push(`select-bed?${queryParams}`)