fix(SW-978): Fallback if no room is selected in URL

This commit is contained in:
Pontus Dreij
2024-11-26 10:27:47 +01:00
parent 86ddd79a38
commit 4de3f4717c

View File

@@ -61,6 +61,14 @@ export default async function SelectHotelPage({
const selectHotelParams = new URLSearchParams(searchParams)
const selectHotelParamsObject =
getHotelReservationQueryParams(selectHotelParams)
if (
!selectHotelParamsObject.room ||
selectHotelParamsObject.room.length === 0
) {
return notFound()
}
const adults = selectHotelParamsObject.room[0].adults // TODO: Handle multiple rooms
const children = selectHotelParamsObject.room[0].child
? generateChildrenString(selectHotelParamsObject.room[0].child)