fix: filter out room availability based on packages
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { redirect } from "next/navigation"
|
||||
|
||||
import { selectRate } from "@/constants/routes/hotelReservation"
|
||||
import {
|
||||
getPackages,
|
||||
getProfileSafely,
|
||||
@@ -17,6 +20,7 @@ import { SelectRateSearchParams } from "@/types/components/hotelReservation/sele
|
||||
import { LangParams, PageArgs, SearchParams } from "@/types/params"
|
||||
|
||||
export default async function SummaryPage({
|
||||
params,
|
||||
searchParams,
|
||||
}: PageArgs<LangParams, SearchParams<SelectRateSearchParams>>) {
|
||||
const selectRoomParams = new URLSearchParams(searchParams)
|
||||
@@ -39,6 +43,7 @@ export default async function SummaryPage({
|
||||
roomStayEndDate: toDate,
|
||||
rateCode,
|
||||
roomTypeCode,
|
||||
packageCodes,
|
||||
})
|
||||
const user = await getProfileSafely()
|
||||
const packages = await getPackages({
|
||||
@@ -50,10 +55,10 @@ export default async function SummaryPage({
|
||||
packageCodes,
|
||||
})
|
||||
|
||||
if (!availability) {
|
||||
if (!availability || !availability.selectedRoom) {
|
||||
console.error("No hotel or availability data", availability)
|
||||
// TODO: handle this case
|
||||
return null
|
||||
redirect(selectRate[params.lang])
|
||||
}
|
||||
|
||||
const prices =
|
||||
|
||||
Reference in New Issue
Block a user