From 888c9d571450ca1b934d94446b4eed462207a2d2 Mon Sep 17 00:00:00 2001 From: Andrey Meshkov Date: Thu, 20 Aug 2020 14:37:57 +0300 Subject: [PATCH] Get rid of extra toast when static IP is not set --- client/src/actions/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/src/actions/index.js b/client/src/actions/index.js index b4a51065..acb76107 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -383,6 +383,7 @@ export const findActiveDhcp = (name) => async (dispatch, getState) => { const v6 = check?.v6 ?? { other_server: {} }; let isError = false; + let isStaticIPError = false; const hasV4Interface = !!interfaces[selectedInterface]?.ipv4_addresses; const hasV6Interface = !!interfaces[selectedInterface]?.ipv6_addresses; @@ -402,12 +403,17 @@ export const findActiveDhcp = (name) => async (dispatch, getState) => { } if (hasV4Interface && v4.static_ip.static === STATUS_RESPONSE.ERROR) { - isError = true; + isStaticIPError = true; dispatch(addErrorToast({ error: 'dhcp_static_ip_error' })); } + if (isError) { dispatch(addErrorToast({ error: 'dhcp_error' })); + } + + if (isStaticIPError || isError) { + // No need to proceed if there was an error discovering DHCP server return; }