cleanup fetch content in sourcesView

This commit is contained in:
Eduard Heimbuch
2020-01-15 08:25:59 +01:00
parent 3f518c501a
commit bee0b68f37

View File

@@ -37,22 +37,20 @@ class SourcesView extends React.Component<Props, State> {
const { file } = this.props; const { file } = this.props;
getContentType(file._links.self.href) getContentType(file._links.self.href)
.then(result => { .then(result => {
if (result.error) {
this.setState({
...this.state,
error: result.error,
loaded: true
});
} else {
this.setState({ this.setState({
...this.state, ...this.state,
contentType: result.type, contentType: result.type,
language: result.language, language: result.language,
loaded: true loaded: true
}); });
}
}) })
.catch(err => {}); .catch(error => {
this.setState({
...this.state,
error,
loaded: true
});
});
} }
showSources() { showSources() {