Fix DHCP check when there is no V6 interface

This commit is contained in:
Andrey Meshkov 2020-08-20 14:25:00 +03:00 committed by Simon Zolin
parent fcc34ca80b
commit 1806816d9c
1 changed files with 6 additions and 3 deletions

View File

@ -387,13 +387,15 @@ export const findActiveDhcp = (name) => async (dispatch, getState) => {
const hasV4Interface = !!interfaces[selectedInterface]?.ipv4_addresses; const hasV4Interface = !!interfaces[selectedInterface]?.ipv4_addresses;
const hasV6Interface = !!interfaces[selectedInterface]?.ipv6_addresses; const hasV6Interface = !!interfaces[selectedInterface]?.ipv6_addresses;
if ((hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) if (hasV4Interface && v4.other_server.found === STATUS_RESPONSE.ERROR) {
|| (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR)) {
isError = true; isError = true;
dispatch(addErrorToast({ error: 'dhcp_error' }));
if (v4.other_server.error) { if (v4.other_server.error) {
dispatch(addErrorToast({ error: v4.other_server.error })); dispatch(addErrorToast({ error: v4.other_server.error }));
} }
}
if (hasV6Interface && v6.other_server.found === STATUS_RESPONSE.ERROR) {
isError = true;
if (v6.other_server.error) { if (v6.other_server.error) {
dispatch(addErrorToast({ error: v6.other_server.error })); dispatch(addErrorToast({ error: v6.other_server.error }));
} }
@ -405,6 +407,7 @@ export const findActiveDhcp = (name) => async (dispatch, getState) => {
} }
if (isError) { if (isError) {
dispatch(addErrorToast({ error: 'dhcp_error' }));
return; return;
} }