fix: rename children to childrenInRoom

This commit is contained in:
Christel Westerberg
2025-01-14 12:25:17 +01:00
parent b2935114e3
commit bcae63e3fc
26 changed files with 104 additions and 91 deletions

View File

@@ -17,8 +17,8 @@ interface HotelSearchDetails<T> {
hotel: Location | null
selectHotelParams: T
adultsInRoom: number
childrenInRoom?: string
childrenInRoomArray?: Child[]
childrenInRoomString?: string
childrenInRoom?: Child[]
}
export async function getHotelSearchDetails<
@@ -48,17 +48,18 @@ export async function getHotelSearchDetails<
if (!city && !hotel) return notFound()
let adultsInRoom = 1
let childrenInRoom: string | undefined = undefined
let childrenInRoomArray: Child[] | undefined = undefined
let childrenInRoomString: HotelSearchDetails<T>["childrenInRoomString"] =
undefined
let childrenInRoom: HotelSearchDetails<T>["childrenInRoom"] = undefined
const { rooms } = selectHotelParams
if (rooms && rooms.length > 0) {
adultsInRoom = rooms[0].adults // TODO: Handle multiple rooms
childrenInRoom = rooms[0].children
? generateChildrenString(rooms[0].children)
childrenInRoomString = rooms[0].childrenInRoom
? generateChildrenString(rooms[0].childrenInRoom)
: undefined // TODO: Handle multiple rooms
childrenInRoomArray = rooms[0].children ? rooms[0].children : undefined // TODO: Handle multiple rooms
childrenInRoom = rooms[0].childrenInRoom // TODO: Handle multiple rooms
}
return {
@@ -66,7 +67,7 @@ export async function getHotelSearchDetails<
hotel: hotel ?? null,
selectHotelParams,
adultsInRoom,
childrenInRoomString,
childrenInRoom,
childrenInRoomArray,
}
}