Skip to content

Instantly share code, notes, and snippets.

@sergiodxa
Last active August 29, 2015 14:21
Show Gist options
  • Save sergiodxa/80dce9a0ac931527d73b to your computer and use it in GitHub Desktop.
Save sergiodxa/80dce9a0ac931527d73b to your computer and use it in GitHub Desktop.
Funciones asíncronas
import xhr from 'promised-xhr';
async function mostrarDatos () {
try {
const data = await xhr.get('/api/resource');
const data2 = await xhr.get(data.body.url);
console.log(`${data2.body}!`);
} catch (err) {
console.log(err);
}
}
mostrarDatos();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment