Skip to content

Commit

Permalink
Allow stopping the request from onResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
zackify committed Feb 23, 2017
1 parent 05525bc commit d77dbeb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utilities/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default (url, options = {}) => {
return new Promise((resolve, reject) => {
fetch(url, options)
.then(response => {
if (options.onResponse) options.onResponse(response)
if (options.onResponse && options.onResponse(response)) return false

response.text()
.then(text => {
Expand Down

0 comments on commit d77dbeb

Please sign in to comment.