summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErnst Widerberg <ernst@sunet.se>2021-11-24 17:11:02 +0100
committerErnst Widerberg <ernst@sunet.se>2021-11-24 17:11:02 +0100
commit37a5be906c22a7a0ab205f50be600ad85f00e80d (patch)
tree7ecc8ed616eefba679c524beb6b20d64eb0a20c8 /src
parentf98b193c7fd0872ebe087baaa851d42203f27ff7 (diff)
Update for backend changes
Diffstat (limited to 'src')
-rw-r--r--src/components/List.js5
-rw-r--r--src/components/ObjectView.js4
2 files changed, 4 insertions, 5 deletions
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));