chore: get start from deploying

This commit is contained in:
jialin
2025-02-24 11:34:40 +08:00
parent 1dd7037aa0
commit bcbefe29e7
11 changed files with 214 additions and 26 deletions
+5 -5
View File
@@ -1,29 +1,29 @@
import { userAtom } from '@/atoms/user';
import Footer from '@/components/footer';
import { history, useModel } from '@umijs/max';
import { useModel } from '@umijs/max';
import { useAtom } from 'jotai';
import { useEffect } from 'react';
import LoginForm from './components/login-form';
import PasswordForm from './components/password-form';
import styles from './components/styles.less';
import { checkDefaultPage } from './utils';
const Login = () => {
const [userInfo, setUserInfo] = useAtom(userAtom);
const { initialState, setInitialState } = useModel('@@initialState') || {};
const gotoDefaultPage = (userInfo: any) => {
const gotoDefaultPage = async (userInfo: any) => {
if (!userInfo || userInfo?.require_password_change) {
return;
}
checkDefaultPage(userInfo, true);
if (!initialState?.currentUser) {
setInitialState((s: any) => ({
...s,
currentUser: userInfo
}));
}
const pathname = userInfo?.is_admin ? '/dashboard' : '/playground';
history.push(pathname, { replace: true });
};
useEffect(() => {
gotoDefaultPage(userInfo);