Last active
August 29, 2015 14:21
-
-
Save sergiodxa/80dce9a0ac931527d73b to your computer and use it in GitHub Desktop.
Funciones asíncronas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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