【发布时间】:2019-08-19 16:19:57
【问题描述】:
我一直在尝试从我的 spring boot localhost restapi 中获取一些值。它正在引发网络错误。我也尝试使用Axios.get() 获取但没有结果。我也在我的springboot 类和方法中给出了CORS(origins='*')。
async componentDidMount()
{
const response = await fetch('http://localhost:8080/jobSeeker/allJobSeekers');
const body = await response.json();
this.setState({ users: body, isLoading: false });
console.log(users);
}
[未处理的承诺拒绝:TypeError:网络请求失败]
- node_modules\react-native\Libraries\vendor\core\whatwg-fetch.js:504:29 in onerror
- 调度事件中的 node_modules\event-target-shim\lib\event-target.js:172:43
- ... 来自框架内部的另外 8 个堆栈帧
【问题讨论】:
标签: java rest spring-boot react-native