Skip to content

Instantly share code, notes, and snippets.

@sergiodxa
Created June 2, 2015 22:15
Show Gist options
  • Save sergiodxa/4e51ac5e93eb55526a00 to your computer and use it in GitHub Desktop.
Save sergiodxa/4e51ac5e93eb55526a00 to your computer and use it in GitHub Desktop.
Resolver múltiples promesas con un solo then
import xhr from 'promised-xhr';
Promise.all([xhr.get('/api/resource'), xhr.get('/api/resource2')])
.then(([data1, data2]) => {
console.log(data1);
console.log(data2);
})
.catch(error => {
console.log(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment