fix: booking widget search type

This commit is contained in:
Michael Zetterberg
2025-05-06 07:32:48 +02:00
parent afda7f851a
commit 4432cdc245
2 changed files with 4 additions and 6 deletions

View File

@@ -1,11 +1,11 @@
import { notFound } from "next/navigation"
import { MEMBERSHIP_FAILED_ERROR } from "@/constants/booking"
import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests"
import BookingConfirmation from "@/components/HotelReservation/BookingConfirmation"
import type { LangParams, PageArgs } from "@/types/params"
import { MEMBERSHIP_FAILED_ERROR } from "@/constants/booking"
export default async function BookingConfirmationPage({
searchParams,

View File

@@ -36,14 +36,12 @@ export default function Form({ type, onClose }: BookingWidgetFormProps) {
const { handleSubmit, setValue } = useFormContext<BookingWidgetSchema>()
function onSubmit(data: BookingWidgetSchema) {
const type = data.city && data.hotel ? "hotel" : "city"
const bookingFlowPage =
type === "city" ? selectHotel(lang) : selectRate(lang)
const bookingFlowPage = data.hotel ? selectRate(lang) : selectHotel(lang)
const bookingWidgetParams = convertObjToSearchParams({
rooms: data.rooms,
...data.date,
...(type === "city" ? { city: data.city } : { hotel: data.hotel }),
...(data.city ? { city: data.city } : {}),
...(data.hotel ? { hotel: data.hotel } : {}),
...(data.bookingCode?.value
? { bookingCode: data.bookingCode.value }
: {}),