feat: consume serach params in summary and step page
This commit is contained in:
@@ -11,7 +11,6 @@ import { CloseLargeIcon } from "@/components/Icons"
|
||||
import { debounce } from "@/utils/debounce"
|
||||
import { getFormattedUrlQueryParams } from "@/utils/url"
|
||||
|
||||
import getHotelReservationQueryParams from "../HotelReservation/SelectRate/RoomSelection/utils"
|
||||
import MobileToggleButton from "./MobileToggleButton"
|
||||
|
||||
import styles from "./bookingWidget.module.css"
|
||||
@@ -41,10 +40,10 @@ export default function BookingWidgetClient({
|
||||
const bookingWidgetSearchData: BookingWidgetSearchParams | undefined =
|
||||
searchParams
|
||||
? (getFormattedUrlQueryParams(new URLSearchParams(searchParams), {
|
||||
adults: "number",
|
||||
age: "number",
|
||||
bed: "number",
|
||||
}) as BookingWidgetSearchParams)
|
||||
adults: "number",
|
||||
age: "number",
|
||||
bed: "number",
|
||||
}) as BookingWidgetSearchParams)
|
||||
: undefined
|
||||
|
||||
const getLocationObj = (destination: string): Location | undefined => {
|
||||
@@ -70,9 +69,9 @@ export default function BookingWidgetClient({
|
||||
|
||||
const selectedLocation = bookingWidgetSearchData
|
||||
? getLocationObj(
|
||||
(bookingWidgetSearchData.city ??
|
||||
bookingWidgetSearchData.hotel) as string
|
||||
)
|
||||
(bookingWidgetSearchData.city ??
|
||||
bookingWidgetSearchData.hotel) as string
|
||||
)
|
||||
: undefined
|
||||
|
||||
const methods = useForm<BookingWidgetSchema>({
|
||||
|
||||
Reference in New Issue
Block a user