使用axios在发送请求时添加withCredentials属性,并使用后端设置Access-Control-Allow-Credentials头。示例如下:
axios.post(url, data, { withCredentials: true }).then(response => { // 请求成功处理逻辑 }).catch(error => { console.log(error) });
上一篇:API未使用dispatch调用。
下一篇:API未响应