Last active
June 2, 2016 09:20
-
-
Save GriffinHeart/4b97dc0a8a0f8a13c315859be980c1c0 to your computer and use it in GitHub Desktop.
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
// Fetcher file | |
const handleErrors = async (...myargs) => { | |
const response = await originalFetch(...myargs); | |
if (!response.ok) { | |
throw Error(response.statusText); | |
} | |
return response; | |
}; | |
// fetch file | |
function localFetch(url, options) { | |
console.log('--------------url========='); | |
console.log(url); | |
console.log('--------------options========='); | |
console.log(options); | |
return fetch(localUrl(url), options); | |
} | |
export { localFetch as default, Request, Headers, Response }; | |
// If I run this like it is the output is: | |
Thu, 02 Jun 2016 08:09:03 GMT server:fetch.server --------------url========= | |
Thu, 02 Jun 2016 08:09:03 GMT server:fetch.server { exports: { default: [Function: Fetcher] }, id: 124, loaded: true } | |
Thu, 02 Jun 2016 08:09:03 GMT server:fetch.server --------------options========= | |
Thu, 02 Jun 2016 08:09:03 GMT server:fetch.server { default: [Function: Fetcher] } | |
// If I add a console.log(args) in handleErrors then the output is correct: | |
Thu, 02 Jun 2016 08:08:50 GMT server:fetch.server --------------url========= | |
Thu, 02 Jun 2016 08:08:50 GMT server:fetch.server //127.0.0.1:9393/api/v1/login | |
Thu, 02 Jun 2016 08:08:50 GMT server:fetch.server --------------options========= | |
Thu, 02 Jun 2016 08:08:50 GMT server:fetch.server { headers: { contentType: 'application/json', Authorization: 'Bearer undefined' }, method: 'post', body: '{"username":{"username":" | |
bleh@bleh.com","password":"password"}}' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment