Created
June 2, 2016 04:05
-
-
Save tnhu/fb44d534f45f029d5cfe45bedbbb23c5 to your computer and use it in GitHub Desktop.
fetch2
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
/* | |
fetch() only rejects when network error occurs (offline), fetch2() rejects all non-200 statuses | |
*/ | |
const fetch2 = api => fetch(api).then(res => res.ok ? res : Promise.reject(res)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment