+ client: handle allowlist refresh
This commit is contained in:
parent
263a7ca6be
commit
90b25300df
|
@ -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());
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
|||
/>
|
||||
<Actions
|
||||
handleAdd={() => toggleFilteringModal({ type: MODAL_TYPE.ADD })}
|
||||
handleRefresh={refreshFilters}
|
||||
handleRefresh={this.handleRefresh}
|
||||
processingRefreshFilters={processingRefreshFilters}
|
||||
whitelist={whitelist}
|
||||
/>
|
||||
|
|
|
@ -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 {
|
|||
/>
|
||||
<Actions
|
||||
handleAdd={() => toggleFilteringModal({ type: MODAL_TYPE.ADD })}
|
||||
handleRefresh={refreshFilters}
|
||||
handleRefresh={this.handleRefresh}
|
||||
processingRefreshFilters={processingRefreshFilters}
|
||||
/>
|
||||
</Card>
|
||||
|
|
Loading…
Reference in New Issue