fix: booking widget search type
This commit is contained in:
@@ -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