vuejs2 - NuxtJS/apollo 如何设置自定义标头
问题描述
如何在@nuxtjs/apollo 上设置自定义标题?
on my nuxt.config.js
我有这样的东西
apollo: {
"x-token": "hash",
"x-auth-token": "hash",
"x-refresh-token": "hash",
headers: {
},
clientConfigs: {
default: {
// required
httpEndpoint: "localhost:4000"
}
}
}
谢谢
解决方案
像这样:
nuxt.conifg.js
apollo: {
clientConfigs: {
default: {
httpEndpoint: 'localhost:4000',
httpLinkOptions: {
headers: {
'x-token': 'hash',
'x-auth-token': 'hash',
'x-refresh-token': 'hash'
}
}
}
}
},
推荐阅读
- node.js - 首先在nodejs winston logger中写入时间戳
- javascript - 如何在chartjs2中绘制一条不同颜色的线?
- c# - 如何忽略出生日期等某些字段的 DateTimeZoneHandling.Utc
- python - 如何使用 PyMC 2.3.7 在 Python 中计算边际似然?
- vue.js - 如何在组件中显示 vuex 存储信息
- javascript - 是否有任何理由使用安全性较低的内容安全策略 (CSP)?
- c# - 使用 naudio 播放连续波声音时如何修复声音削波和杂波
- c++ - Android NDK 未定义对 `std::ios_base::Init::Init()' 的引用
- python - 为什么电报的响应带有 unicode?
- bash - 如何使用 curl 命令的输出进行打印