fix: booking widget search type
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
|
|
||||||
|
import { MEMBERSHIP_FAILED_ERROR } from "@/constants/booking"
|
||||||
import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests"
|
import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests"
|
||||||
|
|
||||||
import BookingConfirmation from "@/components/HotelReservation/BookingConfirmation"
|
import BookingConfirmation from "@/components/HotelReservation/BookingConfirmation"
|
||||||
|
|
||||||
import type { LangParams, PageArgs } from "@/types/params"
|
import type { LangParams, PageArgs } from "@/types/params"
|
||||||
import { MEMBERSHIP_FAILED_ERROR } from "@/constants/booking"
|
|
||||||
|
|
||||||
export default async function BookingConfirmationPage({
|
export default async function BookingConfirmationPage({
|
||||||
searchParams,
|
searchParams,
|
||||||
|
|||||||
@@ -36,14 +36,12 @@ export default function Form({ type, onClose }: BookingWidgetFormProps) {
|
|||||||
const { handleSubmit, setValue } = useFormContext<BookingWidgetSchema>()
|
const { handleSubmit, setValue } = useFormContext<BookingWidgetSchema>()
|
||||||
|
|
||||||
function onSubmit(data: BookingWidgetSchema) {
|
function onSubmit(data: BookingWidgetSchema) {
|
||||||
const type = data.city && data.hotel ? "hotel" : "city"
|
const bookingFlowPage = data.hotel ? selectRate(lang) : selectHotel(lang)
|
||||||
|
|
||||||
const bookingFlowPage =
|
|
||||||
type === "city" ? selectHotel(lang) : selectRate(lang)
|
|
||||||
const bookingWidgetParams = convertObjToSearchParams({
|
const bookingWidgetParams = convertObjToSearchParams({
|
||||||
rooms: data.rooms,
|
rooms: data.rooms,
|
||||||
...data.date,
|
...data.date,
|
||||||
...(type === "city" ? { city: data.city } : { hotel: data.hotel }),
|
...(data.city ? { city: data.city } : {}),
|
||||||
|
...(data.hotel ? { hotel: data.hotel } : {}),
|
||||||
...(data.bookingCode?.value
|
...(data.bookingCode?.value
|
||||||
? { bookingCode: data.bookingCode.value }
|
? { bookingCode: data.bookingCode.value }
|
||||||
: {}),
|
: {}),
|
||||||
|
|||||||
Reference in New Issue
Block a user