Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const originalFetch = fetch;
- // eslint-disable-next-line
- fetch = (url, options) => {
- return originalFetch.apply(window, [url, options]).then(response => {
- if (response.ok) {
- return response;
- }
- if (response.redirected) {
- // make sure request method is GET
- options.method = "GET";
- delete options.body;
- return fetch(response.url, options);
- }
- return response;
- });
- };
Add Comment
Please, Sign In to add comment