mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 20:53:24 +10:00
Remove redundant function params
This commit is contained in:
parent
9232b7e059
commit
fc38342f75
2 changed files with 4 additions and 5 deletions
|
|
@ -19,8 +19,9 @@ export const validURLParamForExtendedData = (paramKey, urlParams, customConfigKe
|
|||
};
|
||||
|
||||
// validate filter params
|
||||
export const validURLParamsForExtendedData = (params, customURLParams, customURLParamToConfig) => {
|
||||
export const validURLParamsForExtendedData = (params, customURLParamToConfig) => {
|
||||
const paramKeys = Object.keys(params);
|
||||
const customURLParams = Object.keys(customURLParamToConfig);
|
||||
return paramKeys.reduce((validParams, paramKey) => {
|
||||
return customURLParams.includes(paramKey)
|
||||
? {
|
||||
|
|
@ -33,8 +34,9 @@ export const validURLParamsForExtendedData = (params, customURLParams, customURL
|
|||
|
||||
// extract search parameters, including a custom URL params
|
||||
// which are validated by mapping the values to marketplace custom config.
|
||||
export const pickSearchParamsOnly = (params, customURLParams, customURLParamToConfig) => {
|
||||
export const pickSearchParamsOnly = (params, customURLParamToConfig) => {
|
||||
const { address, origin, bounds, country, ...rest } = params || {};
|
||||
const customURLParams = Object.keys(customURLParamToConfig);
|
||||
const boundsMaybe = bounds ? { bounds } : {};
|
||||
const originMaybe = config.sortSearchByDistance && origin ? { origin } : {};
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,6 @@ export class SearchPageComponent extends Component {
|
|||
// like mapSearch, page or origin (origin depends on config.sortSearchByDistance)
|
||||
const urlQueryParams = pickSearchParamsOnly(
|
||||
searchInURL,
|
||||
[AMENITIES_URL_PARAM, CATEGORY_URL_PARAM],
|
||||
customURLParamToConfig
|
||||
);
|
||||
|
||||
|
|
@ -180,7 +179,6 @@ export class SearchPageComponent extends Component {
|
|||
const paramsQueryString = stringify(
|
||||
pickSearchParamsOnly(
|
||||
searchParams,
|
||||
[AMENITIES_URL_PARAM, CATEGORY_URL_PARAM],
|
||||
customURLParamToConfig
|
||||
)
|
||||
);
|
||||
|
|
@ -188,7 +186,6 @@ export class SearchPageComponent extends Component {
|
|||
|
||||
const validQueryParams = validURLParamsForExtendedData(
|
||||
searchInURL,
|
||||
[AMENITIES_URL_PARAM, CATEGORY_URL_PARAM],
|
||||
customURLParamToConfig
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue