Pull request: 5190-clear-cache
Updates #4695. Updates #5190. Squashed commit of the following: commit f4156f54ebd1b0c96318715441da1dc54cbbfb0f Author: Ildar Kamalov <ik@adguard.com> Date: Fri Dec 2 16:19:03 2022 +0300 client: button styles commit 42cd8ac8ac1abb5c43a42065e2374d11f2d9a62b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Dec 2 15:39:15 2022 +0300 all: upd dnsproxy commit 87b04391afeaed28523448aa12a317300e718b72 Author: Ildar Kamalov <ik@adguard.com> Date: Fri Dec 2 15:19:07 2022 +0300 client: add clear cache button commit ee99548b3689ce47959d9bddc6a1e866e773dcc3 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Dec 1 18:54:54 2022 +0300 all: add cache clear
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { createAction } from 'redux-actions';
|
||||
import i18next from 'i18next';
|
||||
|
||||
import apiClient from '../api/Api';
|
||||
import { splitByNewLine } from '../helpers/helpers';
|
||||
@@ -19,6 +20,22 @@ export const getDnsConfig = () => async (dispatch) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const clearDnsCacheRequest = createAction('CLEAR_DNS_CACHE_REQUEST');
|
||||
export const clearDnsCacheFailure = createAction('CLEAR_DNS_CACHE_FAILURE');
|
||||
export const clearDnsCacheSuccess = createAction('CLEAR_DNS_CACHE_SUCCESS');
|
||||
|
||||
export const clearDnsCache = () => async (dispatch) => {
|
||||
dispatch(clearDnsCacheRequest());
|
||||
try {
|
||||
const data = await apiClient.clearCache();
|
||||
dispatch(clearDnsCacheSuccess(data));
|
||||
dispatch(addSuccessToast(i18next.t('cache_cleared')));
|
||||
} catch (error) {
|
||||
dispatch(addErrorToast({ error }));
|
||||
dispatch(clearDnsCacheFailure());
|
||||
}
|
||||
};
|
||||
|
||||
export const setDnsConfigRequest = createAction('SET_DNS_CONFIG_REQUEST');
|
||||
export const setDnsConfigFailure = createAction('SET_DNS_CONFIG_FAILURE');
|
||||
export const setDnsConfigSuccess = createAction('SET_DNS_CONFIG_SUCCESS');
|
||||
|
||||
Reference in New Issue
Block a user