diff options
author | Ernst Widerberg <ernstwi@kth.se> | 2021-10-12 16:46:24 +0200 |
---|---|---|
committer | Ernst Widerberg <ernstwi@kth.se> | 2021-10-12 16:46:24 +0200 |
commit | 443c2e1ab711962b6f657f97c86c5cac7b39c6c6 (patch) | |
tree | d2250a03b647dd5d0de5271557c8e0b55a540a04 /src/components/List.js | |
parent | ae78b57552168ded24e604eb11fdd7c67285b11a (diff) |
Update List for backend changes
Diffstat (limited to 'src/components/List.js')
-rw-r--r-- | src/components/List.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/components/List.js b/src/components/List.js index 5f12aa0..bc74020 100644 --- a/src/components/List.js +++ b/src/components/List.js @@ -30,7 +30,14 @@ class List extends React.Component { } }) .then(resp => resp.json()) - .then(data => this.setState({ objects: data })); + .then(resp => { + // TODO: Look at `status` or return code or both? + if (resp.status != "success") + throw `soc_collector responded: ${resp.status}`; + return resp; + }) + .then(resp => this.setState({ objects: resp.data })) + .catch(e => this.props.setError(e)); } filter(field, value) { |