axios 设置申请头中的 Authorization 和 cookie 信息:
GET 申请
axios.get(urlString,
{
headers: {
'Authorization': 'Bearer' + token,
"Cookie" : 'sessionId=' + sessionId + '; recId=' + recId,
...
},
params: {
param1: string,
param2: string
},
...
}
)
.then(res => fn)
.catch(e => fn)
POST 申请
axios.post(urlString,
{
data: data,
...
},
{
headers: {
'Authorization': 'Bearer' + token,
"Cookie" : 'sessionId=' + sessionId + '; recId=' + recId,
...
}
}
)
.then(res => fn)
.catch(e => fn)