diff options
author | therealbobo | 2020-09-14 10:11:45 +0000 |
---|---|---|
committer | therealbobo | 2020-09-14 10:11:45 +0000 |
commit | 83a5fedb95ea211f3bd66ab94d87e82ee1cc51e3 (patch) | |
tree | 0c7336d9561fb22bc9ae32632ab147de371069a9 | |
parent | e1ce4fefede7f956e4b7ae9bc602b4f49fbfad69 (diff) |
added error handling
-rw-r--r-- | frontend/src/views/Config.js | 21 | ||||
-rw-r--r-- | frontend/src/views/Config.scss | 4 |
2 files changed, 23 insertions, 2 deletions
diff --git a/frontend/src/views/Config.js b/frontend/src/views/Config.js index 1468b1b..f5766eb 100644 --- a/frontend/src/views/Config.js +++ b/frontend/src/views/Config.js @@ -20,7 +20,8 @@ class Config extends Component { showConfig: true, tmpUser:"", tmpPass:"", - tmpConf:"" + tmpConf:"", + errors:"" }; this.serverIpChanged = this.serverIpChanged.bind(this); @@ -71,6 +72,7 @@ class Config extends Component { }) }; + let msg = ""; fetch('/setup', requestOptions) .then(response => { @@ -78,7 +80,12 @@ class Config extends Component { //this.setState({showConfig:false}); this.props.onHide(); this.props.onDone(); - console.log(this.props.disabled); + } else { + response.json().then(data => { + this.setState( + {errors : data.error.toString()} + ); + }); } } ); @@ -215,6 +222,16 @@ class Config extends Component { </Col> </Row> + <Row> + <div class="error"> + <b> + {this.state.errors + .split('\n').map((item, key) => { + return <span key={key}>{item}<br/></span>}) + } + </b> + </div> + </Row> </Container> </Modal.Body> diff --git a/frontend/src/views/Config.scss b/frontend/src/views/Config.scss index b0b899f..331d7a7 100644 --- a/frontend/src/views/Config.scss +++ b/frontend/src/views/Config.scss @@ -49,3 +49,7 @@ } } + +.error{ + color: red; +} |