我有一点类似的问题
like this
但我似乎不能把它弄对。我知道我必须这么做
return
export const callGraph = (url, token) => {
return axios.get(url, {headers: { Authorization: `Bearer ${token}` }})
}
这是调用的函数
callGraph
Promise
:
export const getGraphProfile = () => {
if (auth.getAccount()) {
auth.getToken(loginRequest)
.then(response => {
return callGraph(graphConfig.graphMeUrl, response.accessToken)
})
.catch(error => { console.log(error) })
}
}
如你所见,我明确要求
return callGraph
所以我可以这样使用它:
getGraphProfile()
.then(response => { console.log('givenName ', response.data.givenName) })
.catch(error => console.log(error))
出于这样或那样的原因,我仍然缺少一些东西。谢谢你的帮助。