Pre-combine with JiaMin

This commit is contained in:
Vion
2022-01-20 21:46:46 +08:00
parent 66c30b2dd3
commit f93c3c38cc
3 changed files with 11 additions and 6 deletions

View File

@@ -20,14 +20,20 @@ export default async(url = '', data = {}, type = 'GET', method = 'fetch') => {
}
if (window.fetch && method === 'fetch') {
let token='';
let tokenStr = localStorage.getItem("userInfo");
if(tokenStr){
tokenStr = JSON.parse(tokenStr);
if(tokenStr && tokenStr.xaccessToken)
token=tokenStr.xaccessToken;
}
let requestConfig = {
method: type,
headers: {
// 'Accept': 'text/plain',
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'x-access-token': token
},
mode: 'cors',
// channelId:'H5@2021',
cache: 'force-cache'