解决跨域
This commit is contained in:
@ -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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user