Guest User

Untitled

a guest
Nov 18th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. const originalFetch = fetch;
  2. // eslint-disable-next-line
  3. fetch = (url, options) => {
  4. return originalFetch.apply(window, [url, options]).then(response => {
  5. if (response.ok) {
  6. return response;
  7. }
  8. if (response.redirected) {
  9. // make sure request method is GET
  10. options.method = "GET";
  11. delete options.body;
  12. return fetch(response.url, options);
  13. }
  14. return response;
  15. });
  16. };
Add Comment
Please, Sign In to add comment