diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/ServiceList.tsx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/ServiceList.tsx b/src/lib/ServiceList.tsx index 5abae6b..6316ea1 100644 --- a/src/lib/ServiceList.tsx +++ b/src/lib/ServiceList.tsx @@ -52,8 +52,16 @@ const ServiceList: React.FC = () => { history.push(route); }; + const applyFilter = (key: string, value: string) => { + const updatedQuery = { ...query, [key]: value }; + if (value === '-') delete updatedQuery[key]; + + const queryString = new URLSearchParams(updatedQuery); + history.push(`${service.route}?${queryString}`); + }; + return ( - <Page title={service.name} actions={actions} filters={filters}> + <Page title={service.name} actions={actions} filters={filters} applyFilter={applyFilter}> <ListTable items={data} fields={service.tableFields} handleRowClick={handleRowClick} /> </Page> ); |