diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index ed09eb0c..86d329c3 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -101,7 +101,7 @@ export default function (props: any) { }; useEffect(() => { - if (systemInfo && systemInfo.isInitialized && !user.username) { + if (systemInfo && systemInfo.isInitialized) { getUser(); } }, [props.location.pathname]); diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index cb7e2ea1..62b0ff73 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -18,7 +18,7 @@ import { MobileOutlined } from '@ant-design/icons'; const FormItem = Form.Item; const { Countdown } = Statistic; -const Login = () => { +const Login = ({ reloadUser }: any) => { const [loading, setLoading] = useState(false); const [waitTime, setWaitTime] = useState(); const { theme } = useTheme(); @@ -100,8 +100,8 @@ const Login = () => {
上次登录状态:{retries > 0 ? `失败${retries}次` : '成功'}
), - duration: 5, }); + reloadUser(); history.push('/crontab'); } else if (data.code === 100) { message.warn(data.message);