From c222bc06f9c123d3e2fa4a428d74032f54887485 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sat, 17 Apr 2021 19:56:30 +0300
Subject: feat: add ServiceSearch

---
 src/lib/ServiceFilters.tsx | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

(limited to 'src/lib/ServiceFilters.tsx')

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);
-- 
cgit v1.2.3

