mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-27 19:42:11 +10:00
Merge Topbar location search with existing search filters
If the user is on the SearchPage, submitting a new location should also keep the existing query params and merge the new location params with those.
This commit is contained in:
parent
887e031a96
commit
399d966ee0
3 changed files with 7 additions and 3 deletions
|
|
@ -222,10 +222,12 @@ class TopbarComponent extends Component {
|
|||
}
|
||||
|
||||
handleSubmit(values) {
|
||||
const { currentPage, location } = this.props;
|
||||
const { search, selectedPlace } = values.location;
|
||||
const { history } = this.props;
|
||||
const { origin, bounds, country } = selectedPlace;
|
||||
const searchParams = { address: search, origin, bounds, country };
|
||||
const restParams = currentPage === 'SearchPage' ? parse(location.search) : {};
|
||||
const searchParams = { ...restParams, address: search, origin, bounds, country };
|
||||
history.push(createResourceLocatorString('SearchPage', routeConfiguration(), {}, searchParams));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ export class SearchPageComponent extends Component {
|
|||
mainEntity: [schemaMainEntity],
|
||||
}}
|
||||
>
|
||||
<TopbarContainer className={topbarClasses} />
|
||||
<TopbarContainer className={topbarClasses} currentPage="SearchPage" />
|
||||
<div className={css.container}>
|
||||
<div className={css.searchResultContainer}>
|
||||
<SearchFilters
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ exports[`SearchPageComponent matches snapshot 1`] = `
|
|||
scrollingDisabled={false}
|
||||
title="SearchPage.schemaTitle"
|
||||
>
|
||||
<withRouter(Connect(TopbarContainerComponent)) />
|
||||
<withRouter(Connect(TopbarContainerComponent))
|
||||
currentPage="SearchPage"
|
||||
/>
|
||||
<div>
|
||||
<div>
|
||||
<withRouter(InjectIntl(SearchFiltersComponent))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue