24 lines
837 B
TypeScript
24 lines
837 B
TypeScript
import { getFormattedUrlQueryParams } from "@/utils/url"
|
|
|
|
import type { SelectRateSearchParams } from "@/types/components/hotelReservation/selectRate/selectRate"
|
|
|
|
export function getHotelReservationQueryParams(searchParams: URLSearchParams) {
|
|
return getFormattedUrlQueryParams(searchParams, {
|
|
adults: "number",
|
|
age: "number",
|
|
}) as SelectRateSearchParams
|
|
}
|
|
|
|
export function getQueryParamsForEnterDetails(searchParams: URLSearchParams) {
|
|
const selectRoomParamsObject = getHotelReservationQueryParams(searchParams)
|
|
|
|
const { room } = selectRoomParamsObject
|
|
return {
|
|
...selectRoomParamsObject,
|
|
adults: room[0].adults, // TODO: Handle multiple rooms
|
|
children: room[0].child?.length.toString(), // TODO: Handle multiple rooms and children
|
|
roomTypeCode: room[0].roomtype,
|
|
rateCode: room[0].ratecode,
|
|
}
|
|
}
|