Skip to content

Commit

Permalink
Fix setting filters
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislaw-zakrzewski committed Oct 23, 2024
1 parent 75558dc commit c7caa02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ export default function App(): JSX.Element {

const onModalClose = (): void => {
const searchQueryObject = new URLSearchParams(searchQuery);

navigate(
{
pathname:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,18 @@ export default function FiltersDialog({
handleSetModalAlert();
dispatch(setModalOpen(false));

let searchQuery = filtersToURL(values);

if (location.search.includes('?q=')) {
const q = new URLSearchParams(location.search).get('q');
searchQuery = `${searchQuery}&q=${q}`
const searchParams = new URLSearchParams();
for (const [key, value] of Object.entries(values)) {
if (value) searchParams.set(key, value);
}
const searchParamsString = searchParams.toString();

sendCustomGtmEvent('filters_applied', { query: searchQuery });
sendCustomGtmEvent('filters_applied', { query: searchParamsString });

navigate({
pathname: '/cases',
search: searchQuery,
search: searchParamsString,
});
},
});
Expand Down

0 comments on commit c7caa02

Please sign in to comment.