fix(SW-614): remove room availabiltiy from preload

This commit is contained in:
Tobias Johansson
2024-10-30 10:06:59 +01:00
parent b6bec433fb
commit a5fad308ef

View File

@@ -22,12 +22,6 @@ import type { LangParams, PageArgs } from "@/types/params"
export function preload() { export function preload() {
void getProfileSafely() void getProfileSafely()
void getCreditCardsSafely() void getCreditCardsSafely()
void getRoomAvailability({
hotelId: "811",
adults: 1,
roomStayStartDate: "2024-11-01",
roomStayEndDate: "2024-11-02",
})
} }
function isValidStep(step: string): step is StepEnum { function isValidStep(step: string): step is StepEnum {
@@ -42,6 +36,12 @@ export default async function StepPage({
redirect(`/${params.lang}`) redirect(`/${params.lang}`)
} }
void getBreakfastPackages(searchParams.hotel) void getBreakfastPackages(searchParams.hotel)
void getRoomAvailability({
hotelId: searchParams.hotel,
adults: Number(searchParams.adults),
roomStayStartDate: searchParams.checkIn,
roomStayEndDate: searchParams.checkOut,
})
const intl = await getIntl() const intl = await getIntl()
@@ -55,13 +55,14 @@ export default async function StepPage({
adults: Number(searchParams.adults), adults: Number(searchParams.adults),
roomStayStartDate: searchParams.checkIn, roomStayStartDate: searchParams.checkIn,
roomStayEndDate: searchParams.checkOut, roomStayEndDate: searchParams.checkOut,
rateCode: searchParams.rateCode,
}) })
if (!isValidStep(params.step) || !hotel || !roomAvailability) { if (!isValidStep(params.step) || !hotel || !roomAvailability) {
return notFound() return notFound()
} }
const mustBeGuaranteed = false const mustBeGuaranteed = roomAvailability?.mustBeGuaranteed ?? false
const paymentGuarantee = intl.formatMessage({ const paymentGuarantee = intl.formatMessage({
id: "Payment Guarantee", id: "Payment Guarantee",