Last active
February 1, 2018 13:20
-
-
Save lgraubner/8bda37e9076dc0313b6ad04c4a428638 to your computer and use it in GitHub Desktop.
Simple fetch wrapper
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
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