我正在尝试获取对象内部的数据,但是我的对象显示了整个功能。为什么不只显示我的退货声明?解决这个问题的方法是什么?
const fetchContacts = async () => {
try {
await axios.get(url,{
headers: {
'auth': 'asdsdfasfd'
}
}).then(resp => {
const newRows = resp && resp.data && resp.data.map(row =>
({
name: row.name,surname: row.surname,city: row.city,familyNumber: async () => {
try {
const resp = await axios.get(url,{
headers: {
'auth': 'asdsdfasfd'
}
})
return resp.data.length
} catch(error) {
return error
}
},})
)
})
} catch(error) {
return error
}
}