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