Rename amenities url param name const

This commit is contained in:
Hannu Lyytikainen 2018-02-06 13:16:50 +02:00
parent 99ce1f9a01
commit 82487f0daa
2 changed files with 10 additions and 10 deletions

View file

@ -12,7 +12,7 @@ import { createResourceLocatorString } from '../../util/routes';
import css from './SearchFilters.css';
const CATEGORY_URL_PARAM = 'pub_category';
const FEATURES_URL_PARAM = 'pub_amenities';
const AMENITIES_URL_PARAM = 'pub_amenities';
const FILTER_OFFSET = -14;
@ -48,8 +48,8 @@ const SearchFiltersComponent = props => {
id: 'SearchFilters.featuresLabel',
});
const initialFeatures = !!urlQueryParams[FEATURES_URL_PARAM]
? urlQueryParams[FEATURES_URL_PARAM].split(',')
const initialFeatures = !!urlQueryParams[AMENITIES_URL_PARAM]
? urlQueryParams[AMENITIES_URL_PARAM].split(',')
: [];
const initialCategory = urlQueryParams[CATEGORY_URL_PARAM];
@ -57,8 +57,8 @@ const SearchFiltersComponent = props => {
const handleSelectOptions = (urlParam, options) => {
const queryParams =
options && options.length > 0
? { ...urlQueryParams, [FEATURES_URL_PARAM]: options.join(',') }
: omit(urlQueryParams, FEATURES_URL_PARAM);
? { ...urlQueryParams, [AMENITIES_URL_PARAM]: options.join(',') }
: omit(urlQueryParams, AMENITIES_URL_PARAM);
history.push(createResourceLocatorString('SearchPage', routeConfiguration(), {}, queryParams));
};
@ -86,7 +86,7 @@ const SearchFiltersComponent = props => {
const featuresFilter = features ? (
<SelectMultipleFilter
urlParam={FEATURES_URL_PARAM}
urlParam={AMENITIES_URL_PARAM}
label={featuresLabel}
onSelect={handleSelectOptions}
options={features}

View file

@ -43,7 +43,7 @@ const SEARCH_WITH_MAP_DEBOUNCE = 300; // Little bit of debounce before search is
const BOUNDS_FIXED_PRECISION = 8;
const CATEGORY_URL_PARAM = 'pub_category';
const FEATURES_URL_PARAM = 'pub_amenities';
const AMENITIES_URL_PARAM = 'pub_amenities';
// extract search parameters, including a custom attribute named category
const pickSearchParamsOnly = params => {
@ -53,7 +53,7 @@ const pickSearchParamsOnly = params => {
origin,
bounds,
[CATEGORY_URL_PARAM]: rest[CATEGORY_URL_PARAM],
[FEATURES_URL_PARAM]: rest[FEATURES_URL_PARAM],
[AMENITIES_URL_PARAM]: rest[AMENITIES_URL_PARAM],
};
};
@ -110,7 +110,7 @@ export class SearchPageComponent extends Component {
latlngBounds: ['bounds'],
});
const category = rest[CATEGORY_URL_PARAM];
const features = rest[FEATURES_URL_PARAM];
const features = rest[AMENITIES_URL_PARAM];
const viewportGMapBounds = googleMap.getBounds();
const viewportBounds = sdkBoundsToFixedCoordinates(
@ -132,7 +132,7 @@ export class SearchPageComponent extends Component {
country,
mapSearch: true,
[CATEGORY_URL_PARAM]: category,
[FEATURES_URL_PARAM]: features,
[AMENITIES_URL_PARAM]: features,
};
history.push(
createResourceLocatorString('SearchPage', routeConfiguration(), {}, searchParams)