fix: preload requests to avoid needing to promise.all

This commit is contained in:
Christel Westerberg
2024-10-30 16:39:04 +01:00
parent 46622d0515
commit 317619ea78
2 changed files with 36 additions and 47 deletions

View File

@@ -24,18 +24,16 @@ export default async function SummaryPage({
return notFound()
}
const [user, availability] = await Promise.all([
getProfileSafely(),
getSelectedRoomAvailability({
hotelId: parseInt(hotel),
adults,
children,
roomStayStartDate: fromDate,
roomStayEndDate: toDate,
rateCode,
roomTypeCode,
}),
])
const availability = await getSelectedRoomAvailability({
hotelId: parseInt(hotel),
adults,
children,
roomStayStartDate: fromDate,
roomStayEndDate: toDate,
rateCode,
roomTypeCode,
})
const user = await getProfileSafely()
if (!availability) {
console.error("No hotel or availability data", availability)