Created
June 5, 2019 22:25
-
-
Save pinkhominid/8bf92ecf3efa160722a992ab34c98760 to your computer and use it in GitHub Desktop.
fetchJson
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
function fetchJson(url, options) { | |
return fetch(url, { cache: 'no-store', ...options }) | |
.then(res => { if (res.ok) return res; throw res; }) | |
.then(res => res.json()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment