fix: clean up hotel and its typings
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { dt } from "@/lib/dt"
|
||||
import {
|
||||
getHotelData,
|
||||
getHotel,
|
||||
getPackages,
|
||||
getRoomsAvailability,
|
||||
} from "@/lib/trpc/memoizedRequests"
|
||||
@@ -13,33 +13,28 @@ import { generateChildrenString } from "../../utils"
|
||||
import Rooms from "."
|
||||
|
||||
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export type Props = {
|
||||
hotelId: number
|
||||
fromDate: Date
|
||||
toDate: Date
|
||||
adultCount: number
|
||||
childArray?: Child[]
|
||||
lang: Lang
|
||||
}
|
||||
import type { RoomsContainerProps } from "@/types/components/hotelReservation/selectRate/roomsContainer"
|
||||
|
||||
export async function RoomsContainer({
|
||||
hotelId,
|
||||
fromDate,
|
||||
toDate,
|
||||
adultCount,
|
||||
childArray,
|
||||
fromDate,
|
||||
hotelId,
|
||||
lang,
|
||||
}: Props) {
|
||||
toDate,
|
||||
}: RoomsContainerProps) {
|
||||
const session = await auth()
|
||||
const isUserLoggedIn = isValidSession(session)
|
||||
|
||||
const fromDateString = dt(fromDate).format("YYYY-MM-DD")
|
||||
const toDateString = dt(toDate).format("YYYY-MM-DD")
|
||||
|
||||
const hotelDataPromise = safeTry(
|
||||
getHotelData({ hotelId: hotelId.toString(), language: lang })
|
||||
getHotel({
|
||||
hotelId: hotelId.toString(),
|
||||
isCardOnlyPayment: false,
|
||||
language: lang,
|
||||
})
|
||||
)
|
||||
|
||||
const packagesPromise = safeTry(
|
||||
@@ -94,10 +89,10 @@ export async function RoomsContainer({
|
||||
return (
|
||||
<Rooms
|
||||
availablePackages={packages ?? []}
|
||||
roomsAvailability={roomsAvailability}
|
||||
roomCategories={hotelData?.included.rooms ?? []}
|
||||
hotelType={hotelData?.data.attributes?.hotelType}
|
||||
hotelType={hotelData?.hotel.hotelType}
|
||||
isUserLoggedIn={isUserLoggedIn}
|
||||
roomsAvailability={roomsAvailability}
|
||||
roomCategories={hotelData?.roomCategories ?? []}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user