diff --git a/client/src/actions/filtering.js b/client/src/actions/filtering.js index e1ef2219..e3c2de11 100644 --- a/client/src/actions/filtering.js +++ b/client/src/actions/filtering.js @@ -113,11 +113,11 @@ export const refreshFiltersRequest = createAction('FILTERING_REFRESH_REQUEST'); export const refreshFiltersFailure = createAction('FILTERING_REFRESH_FAILURE'); export const refreshFiltersSuccess = createAction('FILTERING_REFRESH_SUCCESS'); -export const refreshFilters = () => async (dispatch) => { +export const refreshFilters = config => async (dispatch) => { dispatch(refreshFiltersRequest()); dispatch(showLoading()); try { - const data = await apiClient.refreshFilters(); + const data = await apiClient.refreshFilters(config); const { updated } = data; dispatch(refreshFiltersSuccess()); diff --git a/client/src/api/Api.js b/client/src/api/Api.js index a5caaa1c..94a05b19 100644 --- a/client/src/api/Api.js +++ b/client/src/api/Api.js @@ -89,9 +89,14 @@ class Api { return this.makeRequest(path, method); } - refreshFilters() { + refreshFilters(config) { const { path, method } = this.FILTERING_REFRESH; - return this.makeRequest(path, method); + const parameters = { + data: config, + headers: { 'Content-Type': 'application/json' }, + }; + + return this.makeRequest(path, method, parameters); } addFilter(config) { diff --git a/client/src/components/Filters/DnsAllowlist.js b/client/src/components/Filters/DnsAllowlist.js index a2eb57ac..da397af5 100644 --- a/client/src/components/Filters/DnsAllowlist.js +++ b/client/src/components/Filters/DnsAllowlist.js @@ -40,11 +40,14 @@ class DnsAllowlist extends Component { this.props.toggleFilterStatus(url, data, whitelist); }; + handleRefresh = () => { + this.props.refreshFilters({ whitelist: true }); + }; + render() { const { t, toggleFilteringModal, - refreshFilters, addFilter, toggleFilterStatus, filtering: { @@ -89,7 +92,7 @@ class DnsAllowlist extends Component { /> toggleFilteringModal({ type: MODAL_TYPE.ADD })} - handleRefresh={refreshFilters} + handleRefresh={this.handleRefresh} processingRefreshFilters={processingRefreshFilters} whitelist={whitelist} /> diff --git a/client/src/components/Filters/DnsBlocklist.js b/client/src/components/Filters/DnsBlocklist.js index 075749d3..e5d182e7 100644 --- a/client/src/components/Filters/DnsBlocklist.js +++ b/client/src/components/Filters/DnsBlocklist.js @@ -37,11 +37,14 @@ class DnsBlocklist extends Component { this.props.toggleFilterStatus(url, data); }; + handleRefresh = () => { + this.props.refreshFilters({ whitelist: false }); + }; + render() { const { t, toggleFilteringModal, - refreshFilters, addFilter, filtering: { filters, @@ -82,7 +85,7 @@ class DnsBlocklist extends Component { /> toggleFilteringModal({ type: MODAL_TYPE.ADD })} - handleRefresh={refreshFilters} + handleRefresh={this.handleRefresh} processingRefreshFilters={processingRefreshFilters} />