fix: booking widget search type
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 }
|
||||
: {}),
|
||||
|
||||
Reference in New Issue
Block a user