提交 b9a53762 authored 作者: 钟是志's avatar 钟是志

跨域功能bug修改

上级 a39d82bf
......@@ -262,9 +262,9 @@ export async function requestOrigin(url, data, options = {}){
// 由于自动添加前缀 这里暂时修改getUrl(url)
let fetchRequest = url.indexOf('UserApi/login') > -1 ? loginUmiRequest : umiRequest;
if (getToken()) {
// if (getToken()) {
options.headers = getHeaders(url).headers;
}
// }
let trueUrl = (options.prefix || '') + url;
const { transformApi, headersApi } = await getTransformApi(trueUrl);
if(getIsBei_Dian()){
......
......@@ -17,19 +17,18 @@ export function getVisitorToken(){
export function getHeaders(url = '', headersApi = undefined) {
let token = getVisitorToken();
const currentInfo = getCurrentUser() || {};
const user = getUserInfo() || {};
const userId = user.id || currentInfo.xgUserId;
const timestamp = user.differenceBetweenServerAndClientTime ? new Date().getTime() + user.differenceBetweenServerAndClientTime : new Date().getTime();
const secretString = token + userId + timestamp;
// const currentInfo = getCurrentUser() || {};
// const user = getUserInfo() || {};
// const userId = user.id || currentInfo.xgUserId;
// const timestamp = user.differenceBetweenServerAndClientTime ? new Date().getTime() + user.differenceBetweenServerAndClientTime : new Date().getTime();
// const secretString = token + userId + timestamp;
const res = {
headers: {},
};
console.log(process.env.NODE_ENV);
if(process.env.NODE_ENV === 'development' && getIsBei_Dian()){
res.headers.env = 'test';
}
if(url && typeof url === 'string' && url.indexOf('oauthPub=true') > -1){ // 公共接口不需要token
return res;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论