Commit 3720288d authored by 崔佳豪's avatar 崔佳豪

fix: 异步更新的globalConfig更新到应用共享状态

parent b4e9e9d7
Pipeline #46928 passed with stages
in 2 minutes 39 seconds
......@@ -8,5 +8,6 @@ export const initialState = {
const actions = initGlobalState(initialState);
// action.setGlobalState({key: value}) 更新状态
// actions.onGlobalStateChange((newState, prevStaet) => {}) 监听状态
export const setGlobalState = actions.setGlobalState;
export const onGlobalStateChange = actions.onGlobalStateChange;
export default actions;
......@@ -25,6 +25,7 @@ import {
VIDEO_LEVEL,
} from './constants';
import createMessage from './message';
import { setGlobalState } from '@/actions';
/* eslint-disable */
// eslint-disable-next-line no-undef
......@@ -557,7 +558,7 @@ class Notifier {
mqtt_IsSSL: true
};
if (Array.isArray(res.getMe) && res.getMe.length > 0) {
debugger
if (res.getMe[0]) {
const data = res.getMe[0];
mqttConfig.mqtt_IsSSL = self._siteConfig.IsSSL = data.IsSSL ? data.IsSSL : false;
......@@ -586,6 +587,10 @@ class Notifier {
...mqttConfig
}))
// 应用共享状态只在initMicro中更新了一次,异步修改了的globalConfig,子应用读取到的是旧的,需要更新一下应用共享状态
setGlobalState({
globalConfig: window.globalConfig
});
}
} else {
Logger.info('获取mqtt服务器参数失败');
......
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