优化 登录

This commit is contained in:
yourname
2025-06-27 04:08:21 +00:00
parent af567310df
commit 527b1b7837
2 changed files with 4 additions and 3 deletions

View File

@@ -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);
}

View File

@@ -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",
});