feat(sw-452): Added correct query params
This commit is contained in:
@@ -26,35 +26,21 @@ export default function RoomSelection({
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const searchParamsObject = getHotelReservationQueryParams(searchParams)
|
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)
|
const queryParams = new URLSearchParams(searchParams)
|
||||||
|
|
||||||
searchParamsObject.room.forEach((item, index) => {
|
searchParamsObject.room.forEach((item, index) => {
|
||||||
queryParams.set(`room[${index}].adults`, item.adults.toString())
|
if (rateSummary?.roomTypeCode) {
|
||||||
|
queryParams.set(`room[${index}].roomtype`, rateSummary.roomTypeCode)
|
||||||
if (Array.isArray(item.child)) {
|
}
|
||||||
item.child.forEach((child, childIndex) => {
|
if (rateSummary?.public?.rateCode) {
|
||||||
queryParams.set(
|
queryParams.set(`room[${index}].ratecode`, rateSummary.public.rateCode)
|
||||||
`room[${index}].child[${childIndex}].age`,
|
}
|
||||||
child.age.toString()
|
if (rateSummary?.member?.rateCode) {
|
||||||
)
|
queryParams.set(
|
||||||
queryParams.set(`room[${index}].child[${childIndex}].bed`, child.bed)
|
`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}`)
|
router.push(`select-bed?${queryParams}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user