From 443c2e1ab711962b6f657f97c86c5cac7b39c6c6 Mon Sep 17 00:00:00 2001 From: Ernst Widerberg Date: Tue, 12 Oct 2021 16:46:24 +0200 Subject: Update List for backend changes --- src/components/List.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/components/List.js') 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) { -- cgit v1.1