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