2017-11-17 25 views
0

저는 현재 Internet Explorer 11Fetch API으로 어려움을 겪고 있습니다.인터넷 익스플로러 11에서 polyfill의 응답 객체가 다릅니다.

나는 다음과 같은 가져 오기 통화가 TypeScript을 unsing 있습니다

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 }); 
    }); 

코드는 ES2015에 TS가 컴파일 한 후 바벨을 사용 ES5까지입니다. 또한 babel-polyfill을 추가했습니다. 예제 코드는 IE가 아닌 다른 브라우저에서 예상대로 작동합니다. IE에서 Response 개체는 완전히 다르며 속성이 심지어 redirected이고 url은 항상 비어 있습니다.

IE에서이 작업을 수행하는 데 사용해야하는 polyfill이 있습니까? 그리고 그렇지 않은 경우, 좋은 해결 방법은 무엇입니까?

답변