forked from vergnet/application-amicale
Fix eslint error
This commit is contained in:
parent
795980dc8d
commit
c62307af7c
1 changed files with 13 additions and 11 deletions
|
@ -94,6 +94,16 @@ class HomeScreen extends React.Component<PropsType, StateType> {
|
|||
static sortFeedTime = (a: FeedItemType, b: FeedItemType): number =>
|
||||
b.time - a.time;
|
||||
|
||||
static generateNewsFeed(rawFeed: RawNewsFeedType): Array<FeedItemType> {
|
||||
const finalFeed = [];
|
||||
Object.keys(rawFeed).forEach((key: string) => {
|
||||
const category: Array<FeedItemType> | null = rawFeed[key];
|
||||
if (category != null && category.length > 0) finalFeed.push(...category);
|
||||
});
|
||||
finalFeed.sort(HomeScreen.sortFeedTime);
|
||||
return finalFeed;
|
||||
}
|
||||
|
||||
isLoggedIn: boolean | null;
|
||||
|
||||
fabRef: {current: null | AnimatedFAB};
|
||||
|
@ -407,7 +417,9 @@ class HomeScreen extends React.Component<PropsType, StateType> {
|
|||
// fetchedData = DATA;
|
||||
if (fetchedData != null) {
|
||||
if (fetchedData.news_feed != null)
|
||||
this.currentNewFeed = this.generateNewsFeed(fetchedData.news_feed);
|
||||
this.currentNewFeed = HomeScreen.generateNewsFeed(
|
||||
fetchedData.news_feed,
|
||||
);
|
||||
if (fetchedData.dashboard != null)
|
||||
this.currentDashboard = fetchedData.dashboard;
|
||||
}
|
||||
|
@ -450,16 +462,6 @@ class HomeScreen extends React.Component<PropsType, StateType> {
|
|||
});
|
||||
};
|
||||
|
||||
generateNewsFeed(rawFeed: RawNewsFeedType): Array<FeedItemType> {
|
||||
const finalFeed = [];
|
||||
Object.keys(rawFeed).forEach((key: string) => {
|
||||
const category: Array<FeedItemType> | null = rawFeed[key];
|
||||
if (category != null && category.length > 0) finalFeed.push(...category);
|
||||
});
|
||||
finalFeed.sort(HomeScreen.sortFeedTime);
|
||||
return finalFeed;
|
||||
}
|
||||
|
||||
render(): React.Node {
|
||||
const {props, state} = this;
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue