Show error message on data error

This commit is contained in:
Chi Vinh Le
2018-01-23 16:53:03 +01:00
parent dd836ad28e
commit 957fd34168
5 changed files with 29 additions and 2 deletions
@@ -73,6 +73,16 @@ class UserDetail extends React.Component {
);
}
renderError() {
return (
<ClickOutside onClickOutside={this.props.hideUserDetail}>
<Drawer onClose={this.props.hideUserDetail}>
<div>{this.props.data.error.message}</div>
</Drawer>
</ClickOutside>
);
}
getActionMenuLabel() {
const { root: { user } } = this.props;
@@ -324,6 +334,10 @@ class UserDetail extends React.Component {
}
render() {
if (this.props.data.error) {
return this.renderError();
}
if (this.props.loading) {
return this.renderLoading();
}
@@ -130,6 +130,7 @@ class UserDetailContainer extends React.Component {
acceptComment={this.acceptComment}
rejectComment={this.rejectComment}
loading={loading}
error={this.props.data && this.props.data.error}
loadMore={this.loadMore}
{...this.props}
/>
@@ -159,7 +159,11 @@ class FlaggedAccountsContainer extends Component {
};
render() {
if (this.props.data.loading || this.props.data.error) {
if (this.props.data.error) {
return <div>{this.props.data.error.message}</div>;
}
if (this.props.data.loading) {
return (
<div>
<Spinner />
@@ -308,7 +312,7 @@ export default compose(
username: [SET, CHANGED]
}
}
limit: 9
limit: 10
}){
hasNextPage
endCursor
@@ -85,6 +85,10 @@ class PeopleContainer extends React.Component {
};
render() {
if (this.props.data.error) {
return <div>{this.props.data.error.message}</div>;
}
if (this.props.data.loading) {
return (
<div>
@@ -277,6 +277,10 @@ class ModerationContainer extends Component {
}
}
if (data.error) {
return <div>{data.error.message}</div>;
}
if (data.loading && data.networkStatus !== 3) {
// loading.
return <Spinner />;