Skip to content

digestMiddleware is swallowing the result of the next action #92

Closed
@sinn1

Description

@sinn1

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions