feat: block all entries to enter details that miss the required params

This commit is contained in:
Simon Emanuelsson
2024-10-31 14:07:59 +01:00
parent 3b75231eee
commit 4513828ae7
4 changed files with 169 additions and 46 deletions

View File

@@ -19,11 +19,6 @@ export default async function SummaryPage({
const { hotel, adults, children, roomTypeCode, rateCode, fromDate, toDate } =
getQueryParamsForEnterDetails(selectRoomParams)
if (!roomTypeCode || !rateCode) {
console.log("No roomTypeCode or rateCode")
return notFound()
}
const availability = await getSelectedRoomAvailability({
hotelId: parseInt(hotel),
adults,

View File

@@ -1,11 +1,10 @@
import { notFound, redirect } from "next/navigation"
import { notFound } from "next/navigation"
import {
getBreakfastPackages,
getCreditCardsSafely,
getHotelData,
getProfileSafely,
getRoomAvailability,
getSelectedRoomAvailability,
} from "@/lib/trpc/memoizedRequests"
import { HotelIncludeEnum } from "@/server/routers/hotels/input"
@@ -38,8 +37,6 @@ export default async function StepPage({
}: PageArgs<LangParams & { step: StepEnum }, SelectRateSearchParams>) {
const { lang } = params
void getBreakfastPackages(searchParams.hotel)
const intl = await getIntl()
const selectRoomParams = new URLSearchParams(searchParams)
const {
@@ -52,10 +49,7 @@ export default async function StepPage({
toDate,
} = getQueryParamsForEnterDetails(selectRoomParams)
if (!rateCode || !roomTypeCode) {
return notFound()
}
void getBreakfastPackages(searchParams.hotel)
void getSelectedRoomAvailability({
hotelId: parseInt(searchParams.hotel),
adults,