From 37a5be906c22a7a0ab205f50be600ad85f00e80d Mon Sep 17 00:00:00 2001 From: Ernst Widerberg Date: Wed, 24 Nov 2021 17:11:02 +0100 Subject: Update for backend changes --- src/components/List.js | 5 ++--- src/components/ObjectView.js | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/List.js b/src/components/List.js index 69f2a50..0bf359b 100644 --- a/src/components/List.js +++ b/src/components/List.js @@ -54,7 +54,7 @@ class List extends React.Component { getData() { fetch(`${process.env.COLLECTOR_URL}/sc/v0/get?${this.queryString()}`, { headers: { - Authorization: "Basic " + btoa("user1:pw1") + Authorization: "Bearer " + localStorage.getItem("token") } }) // TODO: Look at `status` or return code or both? @@ -70,7 +70,7 @@ class List extends React.Component { if (json.status != "success") throw `Unexpected status from soc_collector: ${json.status}`; this.setState({ - objects: json.data + objects: json.docs }); }) .catch(e => this.props.setError(e)); @@ -95,7 +95,6 @@ class List extends React.Component { setPage(event, value) { this.setState({ page: value }, () => { - console.log(this.state); this.getData(); window.scrollTo(0, 0); }); diff --git a/src/components/ObjectView.js b/src/components/ObjectView.js index 3b39c96..cecadeb 100644 --- a/src/components/ObjectView.js +++ b/src/components/ObjectView.js @@ -19,7 +19,7 @@ class ObjectView extends React.Component { getData() { fetch(`${process.env.COLLECTOR_URL}/sc/v0/get/${this.props.id}`, { headers: { - Authorization: "Basic " + btoa("user1:pw1") + Authorization: "Bearer " + localStorage.getItem("token") } }) // TODO: Look at `status` or return code or both? @@ -35,7 +35,7 @@ class ObjectView extends React.Component { if (json.status != "success") throw `Unexpected status from soc_collector: ${json.status}`; this.setState({ - object: json.data + object: json.docs }); }) .catch(e => this.props.setError(e)); -- cgit v1.1