From 362640a392cc9c003e47e234678f60af227b6e1b Mon Sep 17 00:00:00 2001 From: N Kaushik Date: Mon, 2 Apr 2018 16:11:38 +0530 Subject: [PATCH] Add error message display for public feeds --- src/components/Home.jsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/Home.jsx b/src/components/Home.jsx index bf419d8..1d12995 100644 --- a/src/components/Home.jsx +++ b/src/components/Home.jsx @@ -13,7 +13,7 @@ import RepoList from './RepoList'; import { getFeeds, getPublicFeeds, getRepos } from '../service/httpFetch'; import FeedList from './FeedsList'; // import { sentryExtra } from '../lib/utils'; -import { USER_FEEDS_ERROR, USER_REPO_ERROR } from '../lib/constants'; +import { PUBLIC_FEEDS_ERROR, USER_FEEDS_ERROR, USER_REPO_ERROR } from '../lib/constants'; class Home extends Component { constructor(props) { @@ -97,8 +97,6 @@ class Home extends Component { this.setState({ isError: USER_FEEDS_ERROR, }); - }).catch((err) => { - console.log(err); }); } @@ -111,7 +109,9 @@ class Home extends Component { fetchedFeeds: false, }); }).catch((err) => { - console.log(err); + this.setState({ + isError: PUBLIC_FEEDS_ERROR, + }); }); } } @@ -134,15 +134,17 @@ class Home extends Component { const { repoList, feedList } = this.state; const feedError = this.state.isError === USER_FEEDS_ERROR; const repoError = this.state.isError === USER_REPO_ERROR; + const publicFeedError = this.state.isError === PUBLIC_FEEDS_ERROR; return ( -
+
{ this.homeRef = re; }}>

{data && }
- { feedError &&

Please try again.

Can not fetch feeds.

} + { feedError &&

Please try again.

Can not fetch feeds.

} + { publicFeedError &&

Please try again.

Can not fetch feeds.

} @@ -172,7 +174,7 @@ class Home extends Component {
} - { repoError &&

Please try again.

Can not repository list.

} + { repoError &&

Please try again.

Can not repository list.

}