feat(SW-176): set up route
This commit is contained in:
@@ -20,6 +20,7 @@ export default async function SelectHotelPage({
|
|||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
|
|
||||||
// TODO: Use real endpoint.
|
// TODO: Use real endpoint.
|
||||||
|
const tempSearchTerm = "Stockholm"
|
||||||
const hotel = tempHotelData.data.attributes
|
const hotel = tempHotelData.data.attributes
|
||||||
const hotels = [hotel]
|
const hotels = [hotel]
|
||||||
|
|
||||||
@@ -27,7 +28,18 @@ export default async function SelectHotelPage({
|
|||||||
hotelId: "879",
|
hotelId: "879",
|
||||||
})
|
})
|
||||||
|
|
||||||
const tempSearchTerm = "Stockholm"
|
const availability = await serverClient().hotel.availability({
|
||||||
|
cityId: "8ec4bba3-1c38-4606-82d1-bbe3f6738e54",
|
||||||
|
roomStayStartDate: "2024-11-01",
|
||||||
|
roomStayEndDate: "2024-11-02",
|
||||||
|
adults: 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
const filterAvailability = availability?.availability.data.filter(
|
||||||
|
(hotels) => hotels.attributes.status === "Available"
|
||||||
|
)
|
||||||
|
|
||||||
|
console.log(filterAvailability)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className={styles.main}>
|
<main className={styles.main}>
|
||||||
|
|||||||
@@ -510,16 +510,17 @@ const availabilitySchema = z.object({
|
|||||||
data: z.array(
|
data: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
attributes: z.object({
|
attributes: z.object({
|
||||||
checkInDate: z.date(),
|
checkInDate: z.string(),
|
||||||
checkOutDate: z.date(),
|
checkOutDate: z.string(),
|
||||||
occupancy: occupancySchema,
|
occupancy: occupancySchema.optional(),
|
||||||
status: z.string(),
|
status: z.string(),
|
||||||
hotelId: z.number(),
|
hotelId: z.number(),
|
||||||
ratePlanSet: z.string(),
|
ratePlanSet: z.string().optional(),
|
||||||
bestPricePerStay: bestPricePerStaySchema,
|
bestPricePerStay: bestPricePerStaySchema.optional(),
|
||||||
bestPricePerNight: bestPricePerNightSchema,
|
bestPricePerNight: bestPricePerNightSchema.optional(),
|
||||||
}),
|
}),
|
||||||
relationships: linksSchema,
|
relationships: linksSchema.optional(),
|
||||||
|
type: z.string().optional(),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -41,6 +41,14 @@ const getHotelCounter = meter.createCounter("trpc.hotel.get")
|
|||||||
const getHotelSuccessCounter = meter.createCounter("trpc.hotel.get-success")
|
const getHotelSuccessCounter = meter.createCounter("trpc.hotel.get-success")
|
||||||
const getHotelFailCounter = meter.createCounter("trpc.hotel.get-fail")
|
const getHotelFailCounter = meter.createCounter("trpc.hotel.get-fail")
|
||||||
|
|
||||||
|
const availabilityCounter = meter.createCounter("trpc.hotel.availability")
|
||||||
|
const availabilitySuccessCounter = meter.createCounter(
|
||||||
|
"trpc.hotel.availability-success"
|
||||||
|
)
|
||||||
|
const availabilityFailCounter = meter.createCounter(
|
||||||
|
"trpc.hotel.availability-fail"
|
||||||
|
)
|
||||||
|
|
||||||
async function getHotelId(locale: string, uid: string | null | undefined) {
|
async function getHotelId(locale: string, uid: string | null | undefined) {
|
||||||
const rawContentStackData = await request<HotelPageDataRaw>(GetHotelPage, {
|
const rawContentStackData = await request<HotelPageDataRaw>(GetHotelPage, {
|
||||||
locale,
|
locale,
|
||||||
|
|||||||
Reference in New Issue
Block a user