node.js - 请求时标头中的 ref.current 显示为 null
问题描述
当我在标头中传递授权时,我收到一个错误,显示授权为空,但在下面的 console.log 中它可以显示令牌。
useEffect(() => {
if (isLogin) {
axios.post("https://request.com",{}, {
headers: { 'authorization': accessToken.current}
}).then((res) => { console.log(res) }).catch((err) => {
console.log(err.response)
console.log(accessToken.current)
})
}
},[isLogin])
解决方案
推荐阅读
- angular - 组合多个可观察对象并在 Angular 中返回至少一个值时采取行动
- java - 如何实现返回压缩流的 Java 8 通用方法,其中两个流中的对象依次出现?
- c# - 在列表中搜索子类属性
- c++ - 在 Node.js 插件中阻塞调用
- java - out.printf 未打印预期结果
- python - 在 GCP 上通过 python 脚本访问 Kafka 生产者服务器
- python - 如何在 scipy 中生成非周期性方波信号
- php - id 从 url 到 php 变量
- javascript - 反应:分页工作不顺利
- javascript - 如何使用javascript突出显示某一列中具有最小值的表行