Skip to content

Instantly share code, notes, and snippets.

@texas2010
Created September 8, 2020 23:31
Show Gist options
  • Save texas2010/0fee92d49d38ef58c0e8556660aea58a to your computer and use it in GitHub Desktop.
Save texas2010/0fee92d49d38ef58c0e8556660aea58a to your computer and use it in GitHub Desktop.
const getJSON = async (url) => {
try {
const response = await fetch(url)
return await response.json()
} catch (error) {
throw new Error('Unable to get data: ', error)
}
}
export { getJSON as default }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment