修复登录成功获取用户信息

This commit is contained in:
whyour 2022-05-19 23:40:19 +08:00
parent 460a1750f4
commit bdecdce118
2 changed files with 3 additions and 3 deletions

View File

@ -101,7 +101,7 @@ export default function (props: any) {
}; };
useEffect(() => { useEffect(() => {
if (systemInfo && systemInfo.isInitialized && !user.username) { if (systemInfo && systemInfo.isInitialized) {
getUser(); getUser();
} }
}, [props.location.pathname]); }, [props.location.pathname]);

View File

@ -18,7 +18,7 @@ import { MobileOutlined } from '@ant-design/icons';
const FormItem = Form.Item; const FormItem = Form.Item;
const { Countdown } = Statistic; const { Countdown } = Statistic;
const Login = () => { const Login = ({ reloadUser }: any) => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [waitTime, setWaitTime] = useState<any>(); const [waitTime, setWaitTime] = useState<any>();
const { theme } = useTheme(); const { theme } = useTheme();
@ -100,8 +100,8 @@ const Login = () => {
<div>{retries > 0 ? `失败${retries}` : '成功'}</div> <div>{retries > 0 ? `失败${retries}` : '成功'}</div>
</> </>
), ),
duration: 5,
}); });
reloadUser();
history.push('/crontab'); history.push('/crontab');
} else if (data.code === 100) { } else if (data.code === 100) {
message.warn(data.message); message.warn(data.message);