fix: clean up hotel and its typings
This commit is contained in:
@@ -2,7 +2,7 @@ import { differenceInCalendarDays, format, isWeekend } from "date-fns"
|
||||
import { notFound } from "next/navigation"
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { getHotelData } from "@/lib/trpc/memoizedRequests"
|
||||
import { getHotel } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import HotelInfoCard from "@/components/HotelReservation/SelectRate/HotelInfoCard"
|
||||
import { RoomsContainer } from "@/components/HotelReservation/SelectRate/Rooms/RoomsContainer"
|
||||
@@ -28,13 +28,16 @@ export default async function SelectRatePage({
|
||||
}: PageArgs<LangParams & { section: string }, SelectRateSearchParams>) {
|
||||
setLang(params.lang)
|
||||
const searchDetails = await getHotelSearchDetails({ searchParams })
|
||||
if (!searchDetails) return notFound()
|
||||
const { hotel, adultsInRoom, childrenInRoom, selectHotelParams } =
|
||||
searchDetails
|
||||
if (!searchDetails) {
|
||||
return notFound()
|
||||
}
|
||||
const { hotel, adultsInRoom, childrenInRoom, selectHotelParams } = searchDetails
|
||||
|
||||
if (!hotel) return notFound()
|
||||
if (!hotel) {
|
||||
return notFound()
|
||||
}
|
||||
|
||||
const hotelData = await getHotelData({
|
||||
const hotelData = await getHotel({
|
||||
hotelId: hotel.id,
|
||||
language: params.lang,
|
||||
})
|
||||
@@ -72,9 +75,9 @@ export default async function SelectRatePage({
|
||||
leadTime: differenceInCalendarDays(arrivalDate, new Date()),
|
||||
searchType: "hotel",
|
||||
bookingTypeofDay: isWeekend(arrivalDate) ? "weekend" : "weekday",
|
||||
country: hotelData?.data?.attributes.address.country,
|
||||
country: hotelData?.hotel.address.country,
|
||||
hotelID: hotel?.id,
|
||||
region: hotelData?.data?.attributes.address.city,
|
||||
region: hotelData?.hotel.address.city,
|
||||
}
|
||||
|
||||
const hotelId = +hotel.id
|
||||
|
||||
Reference in New Issue
Block a user