Update Filters to use new navigation function

This commit is contained in:
birjolaxew 2020-11-11 11:38:36 +01:00
parent 3524a89fb3
commit 53ac7d3bc7

View File

@ -1,6 +1,6 @@
import React from 'react';
import { withRouter } from 'react-router-dom'
import {removeQueryParam} from './query'
import {navigateToQuery, removeQueryParam} from './query'
import Datamap from 'datamaps'
function filterText(key, value, query) {
@ -56,9 +56,15 @@ function filterText(key, value, query) {
function renderFilter(history, [key, value], query) {
function removeFilter() {
let newQuery = removeQueryParam(location.search, key)
if (key === 'goal') { newQuery = removeQueryParam(newQuery, 'props') }
history.push({search: newQuery})
const newOpts = {
[key]: false
}
if (key === 'goal') { newOpts.props = false }
navigateToQuery(
history,
query,
newOpts
)
}
return (