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

Remove `axios.all` and `axios.spread` #1042

Closed
rubennorte opened this issue Aug 13, 2017 · 8 comments
Closed

Remove `axios.all` and `axios.spread` #1042

rubennorte opened this issue Aug 13, 2017 · 8 comments
Assignees
Labels

Comments

@rubennorte
Copy link
Member

@rubennorte rubennorte commented Aug 13, 2017

Those helpers can easily be replaced with native features (Promise.all and ES6 parameter destructuring) or specialized libraries, so we should restrict our API to HTTP-related methods.

We can deprecate them in 0.x and completely remove then in 1.0.

@rubennorte rubennorte added the feature label Aug 13, 2017
@louisukiri
Copy link

@louisukiri louisukiri commented Aug 24, 2017

Promise.all is not supported in IE at all. Will we then need to use a polyfill?

@rubennorte
Copy link
Member Author

@rubennorte rubennorte commented Aug 24, 2017

Axios uses Promise.all under the hood so you must be polyfilling it already.

@qm3ster
Copy link

@qm3ster qm3ster commented Sep 22, 2017

Should the following in the README example:

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

be replaced with this instead:

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

or this:

const [acct, perms] = await Promise.all([getUserAccount(), getUserPermissions()])
// Both requests are now complete
@ChadTaljaardt
Copy link

@ChadTaljaardt ChadTaljaardt commented Aug 24, 2018

@qm3ster i think the second version is better.

const [acct, perms] = await Promise.all([getUserAccount(), getUserPermissions()])
@qm3ster
Copy link

@qm3ster qm3ster commented Aug 24, 2018

@ChadTaljaardt there's await in the docs already, but the .all example is still axios.all 🍕

https://github.com/axios/axios/blob/master/README.md#example

@ohtaeg
Copy link
Contributor

@ohtaeg ohtaeg commented Jan 10, 2020

I'm interested in #2260 . Do you mind if I try?

@jasonsaayman
Copy link
Collaborator

@jasonsaayman jasonsaayman commented May 27, 2020

Resolved by #2727

@Jossnaz
Copy link

@Jossnaz Jossnaz commented Jul 21, 2020

if someone is looking for a typescript solution:

                const [cat_res, man_res, p_res, cm_res] = await Promise.all<{ data: Category[] },  { data: Manufacturer[] }, { data: Product[] }, { data: Colormatrix }>([
                    Axios.get('/admin/subcategories/read'),
                    Axios.get('/admin/manufacturers/read'),
                    Axios.get('/admin/products/read'),
                    Axios.get('/admin/colormatrices/read'),
                ]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
You can’t perform that action at this time.