Closed
Description
In our particular use case, we use a clientMiddleware to handle API requests which returns a promise. Based on the result of this promise, we may or may not dispatch further actions:
// snippet from clientMiddleware.js return promise(ApiClient).then( (result) => next({...rest, result, type: SUCCESS, receivedAt: Date.now()}), (error) => next({...rest, error, type: FAILURE}) ).catch((error) => { console.error('MIDDLEWARE ERROR:', error); next({...rest, error, type: FAILURE}); });
// usage this.fetchSomethingFromServer().then((success) => this.fetchSomethingElse());
digestMiddleware.js calls:
$rootScope.$evalAsync(next(action);
but doesn't return the result of next(action), so the promise is not returned and can't be chained.
Metadata
Metadata
Assignees
Labels
No labels