I'm currently struggeling with Internet Explorer 11 and the Fetch API.
I have the following fetch-call unsing TypeScript:
await fetch(theForm.action, { method: theForm.method, body: formData, credentials: "include" })
.then((response: Response) => {
if (response.status === 500)
throw Error(response.statusText);
if (response.redirected && response.url)
return window.location.href = response.url;
return response.json();
})
.catch((error: Error) => {
return this.setState({ isSubmitting: false, internalServerError: error });
});
The code is ts-compiled to ES2015 and then down to ES5 using babel. I've also added babel-polyfill. The example code works as expected on other browsers than IE.
As it turns out, the Response-object in IE is totally different and don't even has the property redirected and url is always empty.
Is there any polyfill I should use to make this work in IE? And, if not, what would be a good workaround?
