Skip to content

Instantly share code, notes, and snippets.

@lgraubner
Last active February 1, 2018 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgraubner/8bda37e9076dc0313b6ad04c4a428638 to your computer and use it in GitHub Desktop.
Save lgraubner/8bda37e9076dc0313b6ad04c4a428638 to your computer and use it in GitHub Desktop.
Simple fetch wrapper
const fetchFromApi = async (..args) => {
const response = await fetch(...args)
if (!response.ok) {
throw Error(response.statusText)
}
return response.json()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment