Commit 83c714e2 authored by 崔佳豪's avatar 崔佳豪

fix: 获取网关与获取全局配置互相覆盖引起的异常问题

parent cd7ae4fb
Pipeline #46965 skipped with stages
......@@ -45,23 +45,27 @@ export const initGlobalConfig = () => {
updateTheme('#ff9600');
}
} else {
// eslint-disable-next-line react-hooks/rules-of-hooks
let client = params.getParams('client') || Cookies.get('city')
client = client && client !== 'undefined' ? client : 'city';
appService.getWateWayConfig().then(res => {
const hasGateWay =
res && res.data && isString(res.data) ? JSON.parse(res.data) : res.data;
if (res.code === 0 && res.data === 'true') {
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, {
!res || !res.data ? false : isString(res.data) ? JSON.parse(res.data) : typeof res.data === 'boolean' ? res.data : false;
// if (res.code === 0 && res.data === 'true') {
// store.dispatch(
// actionCreators.getConfig(
// Object.assign({}, window.globalConfig, {
// hasGateWay,
// apiGatewayDomain: `${window.location.origin}/PandaCore`,
// }),
// ),
// );
// }
return {
hasGateWay,
apiGatewayDomain: `${window.location.origin}/PandaCore`,
}),
),
);
}
});
// eslint-disable-next-line react-hooks/rules-of-hooks
let client = params.getParams('client') || Cookies.get('city')
client = client && client !== 'undefined' ? client : 'city';
}).then((gateWayConfig) => {
appService
.queryConfig({
client: client || 'city',
......@@ -69,8 +73,6 @@ export const initGlobalConfig = () => {
})
.then(res => {
if (res) {
store.dispatch(actionCreators.getConfig(Object.assign({})));
const data = res;
if (!data.client) {
data.client = client;
......@@ -82,7 +84,7 @@ export const initGlobalConfig = () => {
token: '',
access_token: '',
userInfo: null
}),
}, gateWayConfig),
),
);
......@@ -132,5 +134,7 @@ export const initGlobalConfig = () => {
console.log(error);
store.dispatch(actionCreators.getConfigError(error));
});
});
}
};
\ No newline at end of file
......@@ -27,10 +27,7 @@ class SecurityLayout extends React.Component {
// const queryString = stringify({
// redirect: window.location.href,
// });
if (
_.isNull(global.token) ||
(global.hasGateWay && _.isNull(global.access_token))
) {
if (!Cookies.get('token')) {
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
let client = global.client || Cookies.get('city');
client =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment