diff --git a/common/components/Header/components/CustomNodeModal.tsx b/common/components/Header/components/CustomNodeModal.tsx index 2ed14479..dc46b9c8 100644 --- a/common/components/Header/components/CustomNodeModal.tsx +++ b/common/components/Header/components/CustomNodeModal.tsx @@ -348,16 +348,18 @@ class CustomNodeModal extends React.Component { name: this.state.name.trim(), url, port, - network: networkId + network: networkId, + ...(this.state.hasAuth + ? { + auth: { + username: this.state.username, + password: this.state.password + } + } + : {}) }; const lib = new CustomNode(node); - if (this.state.hasAuth) { - node.auth = { - username: this.state.username, - password: this.state.password - }; - } return { ...node, lib }; }