public static object fetchMyFutureEvents(int pageNumber, string mode) { return(new ThunkAction <AppState>((dispatcher, getState) => { return MineApi.FetchMyFutureEvents(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 FetchMyFutureEventsSuccessAction { eventIds = eventIds, pageNumber = pageNumber, total = eventsResponse.events.total }); }) .Catch(error => { dispatcher.dispatch(new FetchMyFutureEventsFailureAction()); Debuger.LogError(message: error); }); })); }
public static object fetchMyFutureEvents(int pageNumber) { return(new ThunkAction <AppState>((dispatcher, getState) => { return MineApi.FetchMyFutureEvents(pageNumber) .Then(eventsResponse => { dispatcher.dispatch(new UserMapAction { userMap = eventsResponse.userMap }); dispatcher.dispatch(new PlaceMapAction { placeMap = eventsResponse.placeMap }); dispatcher.dispatch(new FetchMyFutureEventsSuccessAction { eventsResponse = eventsResponse, pageNumber = pageNumber }); }) .Catch(error => { dispatcher.dispatch(new FetchMyFutureEventsFailureAction()); Debug.Log(error); }); })); }