当我从源“http://localhost:3000”获取数据时,在“http://dash.thesportk.com/api/front”访问 XMLHttpRequest 已被 CORS 策略阻止:响应预检请求未通过访问控制检查:预检请求不允许重定向。
useEffect(() => { const fetchData = async () => {
axios.get('http://dash.thesportk.com/api/front?api_token=MY_TOKEN').then(res=>{
console.log('res',res)
})
};
当我输入正确的令牌和正确的标题时,我也会收到错误请求帮助
您可以尝试使用Chrome扩展绕过CORS或要求后端开发人员将localhost添加到白名单