Created
November 15, 2017 02:03
-
-
Save SyNeto/0c788eee57fe4c745c91fe23b1303bdf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fetch('https://min-api.cryptocompare.com/data/price?fsym=MXN&tsyms=BTC') | |
.then(response => { | |
if(response.ok){ | |
return Promise.resolve(response); | |
} else{ | |
return Promise.reject(new Error("No funciona")); | |
} | |
}) | |
.then(response => response.json()) | |
.then(data => { | |
var valor = convertir(data.BTC, cantidad); | |
desplegar(valor); | |
}) | |
.catch(error => { console.log(`Error: ${error}`) }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment