|
@@ -22,7 +22,7 @@ class RevisionLoader extends React.Component {
|
|
|
markdown: '',
|
|
markdown: '',
|
|
|
isLoading: false,
|
|
isLoading: false,
|
|
|
isLoaded: false,
|
|
isLoaded: false,
|
|
|
- error: null,
|
|
|
|
|
|
|
+ errors: null,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
this.loadData = this.loadData.bind(this);
|
|
this.loadData = this.loadData.bind(this);
|
|
@@ -49,15 +49,15 @@ class RevisionLoader extends React.Component {
|
|
|
|
|
|
|
|
this.setState({
|
|
this.setState({
|
|
|
markdown: res.data.revision.body,
|
|
markdown: res.data.revision.body,
|
|
|
- error: null,
|
|
|
|
|
|
|
+ errors: null,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
if (this.props.onRevisionLoaded != null) {
|
|
if (this.props.onRevisionLoaded != null) {
|
|
|
this.props.onRevisionLoaded(res.data.revision);
|
|
this.props.onRevisionLoaded(res.data.revision);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- catch (error) {
|
|
|
|
|
- this.setState({ error });
|
|
|
|
|
|
|
+ catch (errors) {
|
|
|
|
|
+ this.setState({ errors });
|
|
|
}
|
|
}
|
|
|
finally {
|
|
finally {
|
|
|
this.setState({ isLoaded: true, isLoading: false });
|
|
this.setState({ isLoaded: true, isLoading: false });
|
|
@@ -94,8 +94,11 @@ class RevisionLoader extends React.Component {
|
|
|
|
|
|
|
|
// ----- after load -----
|
|
// ----- after load -----
|
|
|
let markdown = this.state.markdown;
|
|
let markdown = this.state.markdown;
|
|
|
- if (this.state.error != null) {
|
|
|
|
|
- markdown = `<span class="text-muted"><em>${this.state.error}</em></span>`;
|
|
|
|
|
|
|
+ if (this.state.errors != null) {
|
|
|
|
|
+ const errorMessages = this.state.errors.map((error) => {
|
|
|
|
|
+ return `<span class="text-muted"><em>${error.message}</em></span>`;
|
|
|
|
|
+ });
|
|
|
|
|
+ markdown = errorMessages.join('');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
return (
|