我收到错误@ types / isomorphic-fetch没有默认导出提取
import fetch from 'isomorphic-fetch';
export const AUTH_FAIL = "AUTH_FAIL"
export const ERROR_FETCH = "EROR_FETCH";
export const SUCCESS_FETCH = "SUCESS_FETCH";
export const START_FETCH = "START_FETCH";
export function start_fetch(){
return function(dispatch: any){
return fetch("http://localhost:8000/api/data")
.then(
response => response.json()
)
}
}
感谢您的帮助。
答案 0 :(得分:2)
我能够通过导入这样的库来使它工作:
import 'isomorphic-fetch';
我不得不在此之前填充ES6 Promises。例如:
import * as e6p from "es6-promise";
(e6p as any).polyfill();