fixed issue where city and hotel is undefined or null

This commit is contained in:
Pontus Dreij
2024-12-13 13:57:44 +01:00
parent 20cbb4b0a0
commit 78bf7ef387
4 changed files with 16 additions and 7 deletions

View File

@@ -1,3 +1,4 @@
import { notFound } from "next/navigation"
import { Suspense } from "react"
import HotelInfoCard from "@/components/HotelReservation/SelectRate/HotelInfoCard"
@@ -17,9 +18,11 @@ export default async function SelectRatePage({
}: PageArgs<LangParams & { section: string }, SelectRateSearchParams>) {
setLang(params.lang)
const searchDetails = await getHotelSearchDetails({ searchParams })
if (!searchDetails) return null
if (!searchDetails) return notFound()
const { hotel, adultsInRoom, childrenInRoomArray } = searchDetails
if (!hotel) return notFound()
const { fromDate, toDate } = getValidDates(
searchParams.fromDate,
searchParams.toDate