示例#1
0
 public static object fetchMyPastEvents(int pageNumber, string mode)
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return MineApi.FetchMyPastEvents(pageNumber: pageNumber, mode: mode)
         .Then(eventsResponse => {
             dispatcher.dispatch(new UserMapAction {
                 userMap = eventsResponse.userMap
             });
             dispatcher.dispatch(new PlaceMapAction {
                 placeMap = eventsResponse.placeMap
             });
             var eventIds = new List <string>();
             var eventMap = new Dictionary <string, IEvent>();
             eventsResponse.events.items.ForEach(eventObj => {
                 eventIds.Add(item: eventObj.id);
                 eventMap.Add(key: eventObj.id, value: eventObj);
             });
             dispatcher.dispatch(new EventMapAction {
                 eventMap = eventMap
             });
             dispatcher.dispatch(new FetchMyPastEventsSuccessAction {
                 eventIds = eventIds,
                 pageNumber = pageNumber,
                 total = eventsResponse.events.total
             });
         })
         .Catch(error => {
             dispatcher.dispatch(new FetchMyPastEventsFailureAction());
             Debuger.LogError(message: error);
         });
     }));
 }
示例#2
0
 public static object fetchMyPastEvents(int pageNumber)
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return MineApi.FetchMyPastEvents(pageNumber)
         .Then(eventsResponse => {
             dispatcher.dispatch(new UserMapAction {
                 userMap = eventsResponse.userMap
             });
             dispatcher.dispatch(new PlaceMapAction {
                 placeMap = eventsResponse.placeMap
             });
             dispatcher.dispatch(new FetchMyPastEventsSuccessAction {
                 eventsResponse = eventsResponse,
                 pageNumber = pageNumber
             });
         })
         .Catch(error => {
             dispatcher.dispatch(new FetchMyPastEventsFailureAction());
             Debug.Log(error);
         });
     }));
 }