+ 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 refreshFiltersFailure = createAction('FILTERING_REFRESH_FAILURE');
|
||||||
export const refreshFiltersSuccess = createAction('FILTERING_REFRESH_SUCCESS');
|
export const refreshFiltersSuccess = createAction('FILTERING_REFRESH_SUCCESS');
|
||||||
|
|
||||||
export const refreshFilters = () => async (dispatch) => {
|
export const refreshFilters = config => async (dispatch) => {
|
||||||
dispatch(refreshFiltersRequest());
|
dispatch(refreshFiltersRequest());
|
||||||
dispatch(showLoading());
|
dispatch(showLoading());
|
||||||
try {
|
try {
|
||||||
const data = await apiClient.refreshFilters();
|
const data = await apiClient.refreshFilters(config);
|
||||||
const { updated } = data;
|
const { updated } = data;
|
||||||
dispatch(refreshFiltersSuccess());
|
dispatch(refreshFiltersSuccess());
|
||||||
|
|
||||||
|
@ -89,9 +89,14 @@ class Api {
|
|||||||
return this.makeRequest(path, method);
|
return this.makeRequest(path, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshFilters() {
|
refreshFilters(config) {
|
||||||
const { path, method } = this.FILTERING_REFRESH;
|
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) {
|
addFilter(config) {
|
||||||
|
@ -40,11 +40,14 @@ class DnsAllowlist extends Component {
|
|||||||
this.props.toggleFilterStatus(url, data, whitelist);
|
this.props.toggleFilterStatus(url, data, whitelist);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleRefresh = () => {
|
||||||
|
this.props.refreshFilters({ whitelist: true });
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
t,
|
t,
|
||||||
toggleFilteringModal,
|
toggleFilteringModal,
|
||||||
refreshFilters,
|
|
||||||
addFilter,
|
addFilter,
|
||||||
toggleFilterStatus,
|
toggleFilterStatus,
|
||||||
filtering: {
|
filtering: {
|
||||||
@ -89,7 +92,7 @@ class DnsAllowlist extends Component {
|
|||||||
/>
|
/>
|
||||||
<Actions
|
<Actions
|
||||||
handleAdd={() => toggleFilteringModal({ type: MODAL_TYPE.ADD })}
|
handleAdd={() => toggleFilteringModal({ type: MODAL_TYPE.ADD })}
|
||||||
handleRefresh={refreshFilters}
|
handleRefresh={this.handleRefresh}
|
||||||
processingRefreshFilters={processingRefreshFilters}
|
processingRefreshFilters={processingRefreshFilters}
|
||||||
whitelist={whitelist}
|
whitelist={whitelist}
|
||||||
/>
|
/>
|
||||||
|
@ -37,11 +37,14 @@ class DnsBlocklist extends Component {
|
|||||||
this.props.toggleFilterStatus(url, data);
|
this.props.toggleFilterStatus(url, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleRefresh = () => {
|
||||||
|
this.props.refreshFilters({ whitelist: false });
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
t,
|
t,
|
||||||
toggleFilteringModal,
|
toggleFilteringModal,
|
||||||
refreshFilters,
|
|
||||||
addFilter,
|
addFilter,
|
||||||
filtering: {
|
filtering: {
|
||||||
filters,
|
filters,
|
||||||
@ -82,7 +85,7 @@ class DnsBlocklist extends Component {
|
|||||||
/>
|
/>
|
||||||
<Actions
|
<Actions
|
||||||
handleAdd={() => toggleFilteringModal({ type: MODAL_TYPE.ADD })}
|
handleAdd={() => toggleFilteringModal({ type: MODAL_TYPE.ADD })}
|
||||||
handleRefresh={refreshFilters}
|
handleRefresh={this.handleRefresh}
|
||||||
processingRefreshFilters={processingRefreshFilters}
|
processingRefreshFilters={processingRefreshFilters}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
Loading…
Reference in New Issue
Block a user