Pull request: client: add reset leases btn

Updates #1691.

Squashed commit of the following:

commit 2c48fb956aba28eae47071c9f7f4d579dde12955
Merge: 38f5191b 7547d3a4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jun 17 14:28:23 2021 +0300

    Merge branch 'master' into 1691-dhcp-reset-form

commit 38f5191bcd62eb53e4663fccdfc2a60247881931
Author: Ildar Kamalov <ik@adguard.com>
Date:   Thu Jun 17 13:14:59 2021 +0300

    client: handle dhcp leases reset

commit a97df17028ca640fd32b4d9762aa54fb381df7e5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jun 16 17:12:10 2021 +0300

    client: add reset leases btn
This commit is contained in:
Ainar Garipov
2021-06-17 14:32:33 +03:00
parent 7547d3a422
commit 5104b79cf6
5 changed files with 63 additions and 18 deletions

View File

@@ -547,6 +547,22 @@ export const resetDhcp = () => async (dispatch) => {
}
};
export const resetDhcpLeasesRequest = createAction('RESET_DHCP_LEASES_REQUEST');
export const resetDhcpLeasesSuccess = createAction('RESET_DHCP_LEASES_SUCCESS');
export const resetDhcpLeasesFailure = createAction('RESET_DHCP_LEASES_FAILURE');
export const resetDhcpLeases = () => async (dispatch) => {
dispatch(resetDhcpLeasesRequest());
try {
const status = await apiClient.resetDhcpLeases();
dispatch(resetDhcpLeasesSuccess(status));
dispatch(addSuccessToast('dhcp_reset_leases_success'));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(resetDhcpLeasesFailure());
}
};
export const toggleLeaseModal = createAction('TOGGLE_LEASE_MODAL');
export const addStaticLeaseRequest = createAction('ADD_STATIC_LEASE_REQUEST');