You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
334 B
12 lines
334 B
export default function getFilterValue(filters, filterKey, filterValueKey, defaultValue) {
|
|
const filter = filters.find((f) => f.key === filterKey);
|
|
|
|
if (!filter) {
|
|
return defaultValue;
|
|
}
|
|
|
|
const filterValue = filter.filters.find((f) => f.key === filterValueKey);
|
|
|
|
return filterValue ? filterValue.value : defaultValue;
|
|
}
|