Created
November 19, 2018 04:09
-
-
Save etoxin/36ef59ba3942dca6832ce419ee9001eb to your computer and use it in GitHub Desktop.
Nice small clean Service
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
/** | |
* API Service | |
* @async | |
* @returns {Promise<Object>} | |
*/ | |
async function Service() { | |
let response = await fetch('/api.json'); | |
if (response.ok) return await response.json(); | |
throw new Error(response.statusText); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment