diff options
| author | Ernst Widerberg <ernst@sunet.se> | 2022-03-30 12:53:34 +0200 |
|---|---|---|
| committer | Ernst Widerberg <ernst@sunet.se> | 2022-03-30 12:54:32 +0200 |
| commit | dcd03d8a3f94505c53e667a4b967a29b698c5728 (patch) | |
| tree | 399c39a193666d72e2fb9dcf0370ced04b1f96b0 /src/components/ObjectView.js | |
| parent | cb77e7928297c39222a813b0de6f3b2768c24c61 (diff) | |
Merge redesign (refs/archive/redesign-2022-03-30)
Diffstat (limited to 'src/components/ObjectView.js')
| -rw-r--r-- | src/components/ObjectView.js | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/components/ObjectView.js b/src/components/ObjectView.js deleted file mode 100644 index 76479c2..0000000 --- a/src/components/ObjectView.js +++ /dev/null @@ -1,56 +0,0 @@ -import React from "react"; - -import ObjectComponent from "./ObjectComponent"; - -class ObjectView extends React.Component { - constructor(props) { - super(props); - this.state = { - object: null - }; - - this.getData = this.getData.bind(this); - } - - componentDidMount() { - this.getData(); - } - - getData() { - fetch(`${window.injectedEnv.COLLECTOR_URL}/sc/v0/get/${this.props.id}`, { - headers: { - Authorization: "Bearer " + this.props.token - } - }) - // TODO: Look at `status` or return code or both? - .then(resp => { - if (resp.status !== 200) - throw new Error( - `Unexpected HTTP response code from soc_collector: ${resp.status} ${resp.statusText}` - ); - return resp.json(); - }) - .then(json => { - if (json.status != "success") - throw new Error( - `Unexpected status from soc_collector: ${json.status}` - ); - this.setState({ - object: json.docs - }); - }) - .catch(e => this.props.setError(e)); - } - - render() { - return ( - <div id="object-view"> - {this.state.object === null ? null : ( - <ObjectComponent {...this.state.object} /> - )} - </div> - ); - } -} - -export default ObjectView; |
