mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 05:00:43 +10:00
Add a null check for category custom attribute
This commit is contained in:
parent
1f936cfd72
commit
5e47b79691
1 changed files with 11 additions and 7 deletions
|
|
@ -8,6 +8,7 @@ import { omit } from 'lodash';
|
|||
import { SelectSingleCustomAttribute } from '../../components';
|
||||
import routeConfiguration from '../../routeConfiguration';
|
||||
import { createResourceLocatorString } from '../../util/routes';
|
||||
import config from '../../config';
|
||||
import css from './SearchFilters.css';
|
||||
|
||||
const SearchFiltersComponent = props => {
|
||||
|
|
@ -51,15 +52,18 @@ const SearchFiltersComponent = props => {
|
|||
history.push(createResourceLocatorString('SearchPage', routeConfiguration(), {}, queryParams));
|
||||
};
|
||||
|
||||
const hasCategoryConfig = config.customAttributes && config.customAttributes.category;
|
||||
const categoryFilter = hasCategoryConfig ? (
|
||||
<SelectSingleCustomAttribute
|
||||
customAttribute="category"
|
||||
urlQueryParams={urlQueryParams}
|
||||
onSelect={onSelectSingle}
|
||||
/>
|
||||
) : null;
|
||||
|
||||
return (
|
||||
<div className={classes}>
|
||||
<div className={css.filters}>
|
||||
<SelectSingleCustomAttribute
|
||||
customAttribute="category"
|
||||
urlQueryParams={urlQueryParams}
|
||||
onSelect={onSelectSingle}
|
||||
/>
|
||||
</div>
|
||||
<div className={css.filters}>{categoryFilter}</div>
|
||||
|
||||
<div className={css.searchResultSummary}>
|
||||
{listingsAreLoaded && resultsCount > 0 ? resultsFound : null}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue