Commit b565e4c2 authored by 邓晓峰's avatar 邓晓峰

fix: 修复首页路径bug

parent 2ffe952b
Pipeline #38840 passed with stages
in 12 minutes 57 seconds
...@@ -124,7 +124,7 @@ const initGlobalConfig = () => { ...@@ -124,7 +124,7 @@ const initGlobalConfig = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks // eslint-disable-next-line react-hooks/rules-of-hooks
appService appService
.queryConfig({ .queryConfig({
client: params.getParams('client') || 'city', client: params.getParams('client') || 'city',
}) })
.then(res => { .then(res => {
if (res) { if (res) {
...@@ -132,7 +132,7 @@ const initGlobalConfig = () => { ...@@ -132,7 +132,7 @@ const initGlobalConfig = () => {
if (!data.client) { if (!data.client) {
data.client = params.getParams('client') || 'city'; data.client = params.getParams('client') || 'city';
} }
// Cookies.set('city', Cookies.get('city')); Cookies.set('city', Cookies.get('city'));
store.dispatch( store.dispatch(
actionCreators.getConfig( actionCreators.getConfig(
Object.assign({}, window.globalConfig, data), Object.assign({}, window.globalConfig, data),
...@@ -187,6 +187,8 @@ const initGlobalConfig = () => { ...@@ -187,6 +187,8 @@ const initGlobalConfig = () => {
} }
}; };
const initSensorType = () => { const initSensorType = () => {
let filterProduct = let filterProduct =
(window.globalConfig && window.globalConfig.products) || []; (window.globalConfig && window.globalConfig.products) || [];
...@@ -224,11 +226,12 @@ const initIsMock = () => { ...@@ -224,11 +226,12 @@ const initIsMock = () => {
initGlobalConfig(); initGlobalConfig();
initLocale(); initLocale();
window.share && window.share && window.share.event && window.share.event.on('triggerMicro', () => {
window.share.event &&
window.share.event.on('triggerMicro', () => {
initMicroApps(loader, store); initMicroApps(loader, store);
}); });
window.share && window.share.event && window.share.event.on('initConfig', () => {
initGlobalConfig();
});
if (pwa) { if (pwa) {
// const appPWA = window.i18n.getI18n('app'); // const appPWA = window.i18n.getI18n('app');
......
...@@ -178,7 +178,8 @@ export function logout(data) { ...@@ -178,7 +178,8 @@ export function logout(data) {
path: '/', path: '/',
}); });
window.globalConfig.token = null; window.globalConfig.token = null;
window.globalConfig.access_token = null window.globalConfig.access_token = null;
window.globalConfig.hasGateWay = false;
} }
Cookies.set('token', '', { Cookies.set('token', '', {
......
...@@ -30,6 +30,7 @@ class SecurityLayout extends React.Component { ...@@ -30,6 +30,7 @@ class SecurityLayout extends React.Component {
if(_.isNull(global.token) || (global.hasGateWay && _.isNull(global.access_token))) { if(_.isNull(global.token) || (global.hasGateWay && _.isNull(global.access_token))) {
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0); this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
window.share && window.share.event && window.share.event.emit('initConfig')
return ( return (
<Redirect to={`/user/login?client=${global.client}`} /> <Redirect to={`/user/login?client=${global.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