fixed issue where city and hotel is undefined or null
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { notFound } from "next/navigation"
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { SelectHotelMapContainer } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainer"
|
||||
@@ -18,9 +19,11 @@ export default async function SelectHotelMapPage({
|
||||
}: PageArgs<LangParams, SelectHotelSearchParams>) {
|
||||
setLang(params.lang)
|
||||
const searchDetails = await getHotelSearchDetails({ searchParams })
|
||||
if (!searchDetails) return null
|
||||
if (!searchDetails) return notFound()
|
||||
const { city, adultsInRoom, childrenInRoom } = searchDetails
|
||||
|
||||
if (!city) return notFound()
|
||||
|
||||
return (
|
||||
<div className={styles.main}>
|
||||
<MapContainer>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { notFound } from "next/navigation"
|
||||
import { Suspense } from "react"
|
||||
|
||||
import SelectHotel from "@/components/HotelReservation/SelectHotel"
|
||||
@@ -15,9 +16,11 @@ export default async function SelectHotelPage({
|
||||
}: PageArgs<LangParams, SelectHotelSearchParams>) {
|
||||
setLang(params.lang)
|
||||
const searchDetails = await getHotelSearchDetails({ searchParams })
|
||||
if (!searchDetails) return null
|
||||
if (!searchDetails) return notFound()
|
||||
const { city, urlSearchParams, adultsInRoom, childrenInRoom } = searchDetails
|
||||
|
||||
if (!city) return notFound()
|
||||
|
||||
const reservationParams = {
|
||||
selectHotelParams: urlSearchParams,
|
||||
searchParams,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,8 +15,8 @@ import type {
|
||||
import type { Location } from "@/types/trpc/routers/hotel/locations"
|
||||
|
||||
interface HotelSearchDetails {
|
||||
city: Location
|
||||
hotel: Location
|
||||
city: Location | null
|
||||
hotel: Location | null
|
||||
urlSearchParams?: URLSearchParams
|
||||
adultsInRoom: number
|
||||
childrenInRoom?: string
|
||||
@@ -67,8 +67,8 @@ export async function getHotelSearchDetails({
|
||||
}
|
||||
|
||||
return {
|
||||
city: city!,
|
||||
hotel: hotel!,
|
||||
city: city ?? null,
|
||||
hotel: hotel ?? null,
|
||||
urlSearchParams,
|
||||
adultsInRoom,
|
||||
childrenInRoom,
|
||||
|
||||
Reference in New Issue
Block a user