优化 登录
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
|||||||
Input,
|
Input,
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
message,
|
App,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import {
|
import {
|
||||||
UserOutlined,
|
UserOutlined,
|
||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
|
|
||||||
// 登录页面
|
// 登录页面
|
||||||
export const LoginPage = () => {
|
export const LoginPage = () => {
|
||||||
|
const { message } = App.useApp();
|
||||||
const { login } = useAuth();
|
const { login } = useAuth();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@@ -46,7 +47,7 @@ export const LoginPage = () => {
|
|||||||
// 登录成功后跳转到管理后台首页
|
// 登录成功后跳转到管理后台首页
|
||||||
navigate('/admin/dashboard');
|
navigate('/admin/dashboard');
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
message.error(error.response?.data?.error || '登录失败');
|
message.error(error instanceof Error ? error.message : '登录失败');
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ export const AppDataSource = new DataSource({
|
|||||||
User, Role
|
User, Role
|
||||||
],
|
],
|
||||||
migrations: [],
|
migrations: [],
|
||||||
synchronize: process.env.DB_SYNCHRONIZE === "true",
|
synchronize: process.env.DB_SYNCHRONIZE !== "false",
|
||||||
logging: process.env.DB_LOGGING === "true",
|
logging: process.env.DB_LOGGING === "true",
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user