从Promise.loper.los.和Axios呼叫的Promiseresult对象中获取数据
我正在使用以下代码,我的目的是从返回承诺的ProsiserSult对象的数据部分中获取数据。我使用以下代码:
const promiseComment = axios.post(`${BASE_URL}/api/addComment/`, data, getDefaultHeaders());
let allPromises = []
allPromises.push(promiseComment)
Promise.all([allPromises])
.then(function (values) {
console.log(values[0][0]);
});
当我安装值时,我会得到以下响应,我需要的是我在以下图像中标记的响应中的数据部分。
预先感谢
I am using the following code and my aim is to get the data from the data section of the PromiseResult object of the returned Promise. I am using the following code:
const promiseComment = axios.post(`${BASE_URL}/api/addComment/`, data, getDefaultHeaders());
let allPromises = []
allPromises.push(promiseComment)
Promise.all([allPromises])
.then(function (values) {
console.log(values[0][0]);
});
When I console the values, I get the following response, what I need is the data section from the response which I marked in the following image.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要解决内部的承诺
you need to resolve the promise inside