diff --git a/components/Main.js b/components/Main.js
index 63ac060..e59c6df 100644
--- a/components/Main.js
+++ b/components/Main.js
@@ -35,6 +35,7 @@ export default class Main extends Component {
this.state = {
articles: dataSource,
loaderImage:false,
+ dataSetEmpty: false,
offset: 1
}
@@ -74,9 +75,15 @@ export default class Main extends Component {
loaderImage:!this.state.loaderImage
});
}
+ toggleEmptyResult ( value ) {
+ this.setState({
+ dataSetEmpty: value
+ });
+ }
render() {
const { articles } = this.state;
+
const loaderImage = require('../assets/loading.gif');
const loadMore = require('../assets/plus-button.gif');
@@ -91,11 +98,13 @@ export default class Main extends Component {
style={ styles.loaderImage }/>
)}
-
-
-
+ {renderIf(this.state.dataSetEmpty)(
+ Empty Result
+ )}
+
);
}
@@ -111,6 +120,9 @@ export default class Main extends Component {
});
}).then(() => {
this.toggleImageLoader();
+ var emptyValue = this.state.articles._cachedRowCount == 0
+ ? true : false;
+ this.toggleEmptyResult(emptyValue);
})
.catch((error) => {
throw error;
@@ -150,4 +162,7 @@ export default class Main extends Component {
width:15,
height:15
},
+ emptyResult: {
+ marginTop: 10
+ }
});
diff --git a/components/Root.js b/components/Root.js
index c74a8e5..1d34d06 100644
--- a/components/Root.js
+++ b/components/Root.js
@@ -20,7 +20,6 @@ export default class Root extends Component {
{
return ;
}
-console.log(route);
return ;
};
diff --git a/utils/core.js b/utils/core.js
index 09a47dd..157f318 100644
--- a/utils/core.js
+++ b/utils/core.js
@@ -5,7 +5,7 @@ export default function get(url){
export default function searchFor(query, offset){
const requestUrl = (
- `http://content.guardianapis.com/search?show-elements=all&show-blocks=body&show-fields=lastModified,byline,headline,trailText,thumbnail,body&page-size=20&page=${ offset }&q=${ query }&type=article&api-key=4f508039-f7af-4b2e-838b-4766794a86ea&order-by=newest`
+ `http://content.guardianapis.com/search?show-elements=all&show-blocks=body&show-fields=lastModified,byline,headline,trailText,thumbnail,body&page-size=20&page=${ offset }&q=${ query }&type=article&api-key=api-key&order-by=newest`
);
return get(requestUrl)