Commit 06d103a9 authored by 崔佳豪's avatar 崔佳豪

fix: 修复token登录信息错乱

parent 3c601ffb
Pipeline #55909 passed with stages
import '@wisdom-utils/utils/lib/helpers/format';
import React, { forwardRef, useEffect, useState } from 'react';
import React, { forwardRef, useEffect, useRef, useState } from 'react';
import { connect } from 'react-redux';
import { useHistory } from '@wisdom-utils/runtime';
import { actionCreators } from '@/containers/App/store';
......@@ -10,9 +10,18 @@ const Login = forwardRef((props, _ref) => {
const history = useHistory();
const [action, setAction] = useState(
() =>
new LoginAction(Object.assign({}, props, { history }), () => {}, true),
new LoginAction(Object.assign({}, props, { history }), () => {}, false),
);
// 需要在 GetGateWay 和 GetConfig 之后再执行登录。避免信息错落
const hasLogin = useRef();
useEffect(() => {
if (props.global && props.global.hasOwnProperty('products') && hasLogin.current !== true) {
hasLogin.current = true;
action.init();
}
}, [props.global]);
useEffect(() => {
action.globalConfig = props.global;
}, [action.globalConfig, props.global]);
......@@ -30,7 +39,6 @@ const Login = forwardRef((props, _ref) => {
);
// window.share.event.emit('triggerMicro', props.global);
// initMicroApps();
debugger
defaultApp();
});
return () => {
......
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