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

return result from callback #106

Merged
merged 1 commit into from
Sep 21, 2015

Conversation

theverything
Copy link
Contributor

Returning the result of the callback allows you to chain the promise like you would expect.

function getUserAccount() {
  return axios.get('/user/12345');
}

function getUserPermissions() {
  return axios.get('/user/12345/permissions');
}

axios.all([getUserAccount(), getUserPermissions()])
  .then(axios.spread(function (acct, perms) {
    return doSomethingWithAccount(acct);
  }))
  .then(function (result) {
    // do stuff with result
  });

returning the result of the callback allows you to chain the promise
like you would expect
mzabriskie added a commit that referenced this pull request Sep 21, 2015
@mzabriskie mzabriskie merged commit 68867fb into axios:master Sep 21, 2015
@axios axios locked and limited conversation to collaborators May 4, 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

Successfully merging this pull request may close these issues.

2 participants