|
@@ -38,7 +38,7 @@ export default class ProximoMainScreen extends FetchedDataSectionList {
|
38
|
38
|
return [
|
39
|
39
|
{
|
40
|
40
|
title: '',
|
41
|
|
- data: ProximoMainScreen.generateData(fetchedData),
|
|
41
|
+ data: this.generateData(fetchedData),
|
42
|
42
|
extraData: super.state,
|
43
|
43
|
keyExtractor: this.getKeyExtractor
|
44
|
44
|
}
|
|
@@ -52,7 +52,7 @@ export default class ProximoMainScreen extends FetchedDataSectionList {
|
52
|
52
|
* @param fetchedData The array of articles represented by objects
|
53
|
53
|
* @returns {Array} The formatted dataset
|
54
|
54
|
*/
|
55
|
|
- static generateData(fetchedData: Object) {
|
|
55
|
+ generateData(fetchedData: Object) {
|
56
|
56
|
let finalData = [];
|
57
|
57
|
if (fetchedData.types !== undefined && fetchedData.articles !== undefined) {
|
58
|
58
|
let types = fetchedData.types;
|
|
@@ -84,7 +84,7 @@ export default class ProximoMainScreen extends FetchedDataSectionList {
|
84
|
84
|
* @param type The type of articles to find (undefined for any type)
|
85
|
85
|
* @return {Array} The array of available articles
|
86
|
86
|
*/
|
87
|
|
- static getAvailableArticles(articles: Array<Object>, type: ?Object) {
|
|
87
|
+ getAvailableArticles(articles: Array<Object>, type: ?Object) {
|
88
|
88
|
let availableArticles = [];
|
89
|
89
|
for (let k = 0; k < articles.length; k++) {
|
90
|
90
|
if ((type !== undefined && type !== null && articles[k]['type'].includes(type['id'])
|
|
@@ -109,7 +109,8 @@ export default class ProximoMainScreen extends FetchedDataSectionList {
|
109
|
109
|
name: i18n.t('proximoScreen.all'),
|
110
|
110
|
icon: 'star'
|
111
|
111
|
},
|
112
|
|
- data: this.getAvailableArticles(this.state.fetchedData.articles, undefined)
|
|
112
|
+ data: this.state.fetchedData.articles !== undefined ?
|
|
113
|
+ this.getAvailableArticles(this.state.fetchedData.articles, undefined) : []
|
113
|
114
|
},
|
114
|
115
|
};
|
115
|
116
|
|