diff options
Diffstat (limited to 'src/lib/ServiceFilters.tsx')
-rw-r--r-- | src/lib/ServiceFilters.tsx | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lib/ServiceFilters.tsx b/src/lib/ServiceFilters.tsx index 4a7f166..8a1e160 100644 --- a/src/lib/ServiceFilters.tsx +++ b/src/lib/ServiceFilters.tsx @@ -14,7 +14,7 @@ const getOptionLabel = (item: any, filter: Filter) => { const ServiceFilters: React.FC = () => { const service = useContext(ServiceContext); - const query = useQuery(); + const { query, setQuery } = useQuery(); const history = useHistory(); const { data } = hooks[service.route].useList('', { revalidateOnMount: !_.isEmpty(query) }); @@ -41,9 +41,7 @@ const ServiceFilters: React.FC = () => { const { value } = event.target; const updatedQuery = { ...query, [key]: value }; if (value === '-') delete updatedQuery[key]; - - const queryString = new URLSearchParams(updatedQuery); - history.push(`${service.route}?${queryString}`); + setQuery(updatedQuery); }; const resetFilters = () => history.push(service.route); |