Пример #1
0
 public static object fetchFollowArticles(int pageNumber)
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return ArticleApi.FetchFollowArticles(pageNumber)
         .Then(followArticlesResponse => {
             dispatcher.dispatch(new UserMapAction {
                 userMap = followArticlesResponse.userMap
             });
             dispatcher.dispatch(new TeamMapAction {
                 teamMap = followArticlesResponse.teamMap
             });
             dispatcher.dispatch(new FollowMapAction {
                 followMap = followArticlesResponse.followMap
             });
             dispatcher.dispatch(new LikeMapAction {
                 likeMap = followArticlesResponse.likeMap
             });
             dispatcher.dispatch(new FetchFollowArticleSuccessAction {
                 pageNumber = pageNumber,
                 projects = followArticlesResponse.projects,
                 projectHasMore = followArticlesResponse.projectHasMore,
                 hottests = followArticlesResponse.hottests,
                 hottestHasMore = followArticlesResponse.hottestHasMore
             });
         })
         .Catch(error => {
             dispatcher.dispatch(new FetchFollowArticleFailureAction());
             Debug.Log(error);
         });
     }));
 }
Пример #2
0
 public static object fetchFollowArticles(int pageNumber, string beforeTime, string afterTime, bool isFirst,
                                          bool isHot)
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return ArticleApi.FetchFollowArticles(pageNumber: pageNumber, beforeTime: beforeTime,
                                               afterTime: afterTime, isFirst: isFirst, isHot: isHot)
         .Then(followArticlesResponse => {
             dispatcher.dispatch(new ArticleMapAction
             {
                 articleMap = followArticlesResponse.projectSimpleMap
             });
             dispatcher.dispatch(new UserMapAction {
                 userMap = followArticlesResponse.userMap
             });
             dispatcher.dispatch(new UserLicenseMapAction
             {
                 userLicenseMap = followArticlesResponse.userLicenseMap
             });
             dispatcher.dispatch(new TeamMapAction {
                 teamMap = followArticlesResponse.teamMap
             });
             dispatcher.dispatch(new FollowMapAction {
                 followMap = followArticlesResponse.followMap
             });
             dispatcher.dispatch(new LikeMapAction {
                 likeMap = followArticlesResponse.likeMap
             });
             dispatcher.dispatch(new FetchFollowArticleSuccessAction {
                 feeds = followArticlesResponse.feeds,
                 feedHasNew = followArticlesResponse.feedHasNew,
                 feedIsFirst = followArticlesResponse.feedIsFirst,
                 feedHasMore = followArticlesResponse.feedHasMore,
                 hotItems = followArticlesResponse.hotItems,
                 hotHasMore = followArticlesResponse.hotHasMore,
                 hotPage = followArticlesResponse.hotPage,
                 pageNumber = pageNumber
             });
         })
         .Catch(error => {
             dispatcher.dispatch(new FetchFollowArticleFailureAction());
             Debuger.LogError(message: error);
         });
     }));
 }