From 394fc5a9d8a2fef42e94a08d7f2c3394e0c05b8c Mon Sep 17 00:00:00 2001 From: Artem Baskal Date: Mon, 16 Nov 2020 12:56:55 +0300 Subject: [PATCH] - client: 2300 Fix block client bug when clients values are empty in config Close #2300 Squashed commit of the following: commit 7222a03ebf3bf8aa93fbd819227e1d5caacce92b Merge: 91b06b10e 09196118e Author: Artem Baskal Date: Mon Nov 16 12:46:26 2020 +0300 Merge branch 'master' into fix/2300 commit 91b06b10e5d46472c9474032d0ae11dc8d0e4609 Author: Artem Baskal Date: Fri Nov 13 15:12:31 2020 +0300 - client: 2300 Fix block client bug when clients values are empty in config --- client/src/actions/access.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/actions/access.js b/client/src/actions/access.js index 17acb5e8..3cbc8016 100644 --- a/client/src/actions/access.js +++ b/client/src/actions/access.js @@ -51,9 +51,10 @@ export const toggleClientBlockSuccess = createAction('TOGGLE_CLIENT_BLOCK_SUCCES export const toggleClientBlock = (ip, disallowed, disallowed_rule) => async (dispatch) => { dispatch(toggleClientBlockRequest()); try { - const { - allowed_clients, blocked_hosts, disallowed_clients = [], - } = await apiClient.getAccessList(); + const accessList = await apiClient.getAccessList(); + const allowed_clients = accessList.allowed_clients ?? []; + const blocked_hosts = accessList.blocked_hosts ?? []; + const disallowed_clients = accessList.disallowed_clients ?? []; const updatedDisallowedClients = disallowed ? disallowed_clients.filter((client) => client !== disallowed_rule)