解决跨域

This commit is contained in:
taozi
2021-12-09 16:00:36 +08:00
parent f49e88555b
commit 730f09176e

View File

@ -71,20 +71,20 @@ function baseRequest(options) {
// 合并传参过来的 headers // 合并传参过来的 headers
// 如果接口需要登录,携带 token 去请求 // 如果接口需要登录,携带 token 去请求
console.log(options) console.log(options)
options.headers = { options.headers = {
...options.headers, ...options.headers,
// hahah: 'Bearer2 ', // hahah: 'Bearer2 ',
}
if(options.method=='post'){
options.headers.hahah='Bearer2 '
} }
// if(options.method=='post'){
// options.headers.hahah='Bearer2 '
// }
if (options.login === true) { if (options.login === true) {
options.headers = { options.headers = {
...options.headers, ...options.headers,
Authorization: 'Bearer ' + token, Authorization: 'Bearer ' + token,
} }
} }