Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support named results in .all #16

Closed
kentcdodds opened this issue Oct 1, 2014 · 1 comment
Closed

Support named results in .all #16

kentcdodds opened this issue Oct 1, 2014 · 1 comment

Comments

@kentcdodds
Copy link

Like async's parallel. So it could go from this:

axios.all([getUserAccount(), getUserPermissions()])
    .then(axios.spread(function (acct, perms) {
        // Both requests are now complete
    }));

to this:

axios.all({ acct: getUserAccount(), perms: getUserPermissions()})
    .then(function (results) {
        // Both requests are now complete
        var acct = results.acct;
        var perms = results.perms;
    });

This makes adding new requests to all simpler because you don't have to keep track of the order of items. This is how I normally do stuff when I use async. Just thought I'd suggest it.

@mzabriskie
Copy link
Member

I generally like the concept, however axios.all is just an alias for Promise.all. I don't want to deviate from the ES6 spec as it makes the API less predictable.

@axios axios locked and limited conversation to collaborators May 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants