Created
October 12, 2021 03:53
-
-
Save dfkuro/54c05bd23b29d37c399d778cd93c729b 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
const fetchJson = (...args) => | |
fetch(...args).then(response => { | |
if(!response.ok) { | |
throw new Error(`HTTP Error response: ${repsponse.status} ${response.statusText}`) | |
} | |
return response.json() | |
}) | |
// Fetching JSON is simplified | |
const data = await fetchJson('https://blockchain.info/ticker') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment