提交 a89c3a69 authored 作者: 姚鑫国's avatar 姚鑫国

防止访问undefined下数据

上级 bf20b749
......@@ -6,14 +6,16 @@ import { getUserInfo } from './currentUser';
import { isJSON } from '../authority';
// import { getUrlParams } from '@/H5Public/utils/handleString';
let getSystemConfig = () => getYunShangGuiZhouSyStemConfig() || window.specialImportantSystemConfig || {};
export const getSysCode = () => {
return getYunShangGuiZhouSyStemConfig().sysCode || window.specialImportantSystemConfig.sysCode;
return getSystemConfig.sysCode;
};
export const setYunShangGuiZhouSystemCode = (code) => {
const localStorageData = localStorage.getItem('antd-pro-systemConfig');
if(!localStorageData || !localStorageData.includes(code)){
if (!localStorageData || !localStorageData.includes(code)) {
localStorage.setItem('antd-pro-systemConfig', JSON.stringify({
code: code,
}));
......@@ -42,6 +44,7 @@ export const getYunShangGuiZhouSyStemConfig = () => {
export function getHeaders(url = '') {
const token = getToken();
const systemConfig = getSystemConfig();
// const currentInfo = getCurrentUser();
// const onestopInfo = getUserInfo();
// const id = onestopInfo.id || currentInfo.xgUserId;
......@@ -52,10 +55,10 @@ export function getHeaders(url = '') {
headers: {
Authorization: `bearer ${token}`,
sysCode: getSysCode(),
tenant: getUserInfo().tenantCode || window.specialImportantSystemConfig.tenant,
tenant: getUserInfo().tenantCode || systemConfig.tenant,
},
};
if(getIsBei_Dian() && window.location.origin.indexOf('localhost') > -1){
if (getIsBei_Dian() && window.location.origin.indexOf('localhost') > -1) {
// 北电科一站式必须加这个才能调得通
res.headers.env = 'test';
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论