mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 12:43:11 +10:00
SearchPage: fix undefined origin
This commit is contained in:
parent
1650a87370
commit
4cb1a6f80b
2 changed files with 5 additions and 8 deletions
|
|
@ -86,9 +86,10 @@ const validURLParamsForExtendedData = params => {
|
|||
// extract search parameters, including a custom attribute named category
|
||||
const pickSearchParamsOnly = params => {
|
||||
const { address, origin, bounds, country, ...rest } = params || {};
|
||||
const originMaybe = config.sortSearchByDistance ? { origin } : {};
|
||||
const boundsMaybe = bounds ? { bounds } : {};
|
||||
const originMaybe = config.sortSearchByDistance && origin ? { origin } : {};
|
||||
return {
|
||||
bounds,
|
||||
...boundsMaybe,
|
||||
...originMaybe,
|
||||
...validURLParamForExtendedData(CATEGORY_URL_PARAM, rest),
|
||||
...validURLParamForExtendedData(AMENITIES_URL_PARAM, rest),
|
||||
|
|
@ -552,7 +553,7 @@ SearchPage.loadData = (params, search) => {
|
|||
latlngBounds: ['bounds'],
|
||||
});
|
||||
const { page = 1, address, country, origin, ...rest } = queryParams;
|
||||
const originMaybe = config.sortSearchByDistance ? { origin } : {};
|
||||
const originMaybe = config.sortSearchByDistance && origin ? { origin } : {};
|
||||
return searchListings({
|
||||
...rest,
|
||||
...originMaybe,
|
||||
|
|
|
|||
|
|
@ -19,11 +19,7 @@ exports[`SearchPageComponent matches snapshot 1`] = `
|
|||
>
|
||||
<withRouter(Connect(TopbarContainerComponent))
|
||||
currentPage="SearchPage"
|
||||
currentSearchParams={
|
||||
Object {
|
||||
"bounds": undefined,
|
||||
}
|
||||
}
|
||||
currentSearchParams={Object {}}
|
||||
/>
|
||||
<div>
|
||||
<div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue