refactor(web): 前端错误处理统一化 — 9 个文件 13 处替换 handleApiError
统一使用 api/client.ts 的 handleApiError() 替代内联错误提取: - Login/Users/Roles/Organizations/Settings 操作失败提示 - ArticleEditor/ArticleTagManage/ArticleCategoryManage 表单错误 - FamilyMembersTab 家庭成员操作 零 response?.data?.message 内联模式残留
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
} from '../api/users';
|
||||
import { listRoles, type RoleInfo } from '../api/roles';
|
||||
import type { UserInfo } from '../api/auth';
|
||||
import { handleApiError } from '../api/client';
|
||||
import { useThemeMode } from '../hooks/useThemeMode';
|
||||
|
||||
const STATUS_COLOR_MAP: Record<string, string> = {
|
||||
@@ -135,9 +136,7 @@ export default function Users() {
|
||||
form.resetFields();
|
||||
fetchUsers();
|
||||
} catch (err: unknown) {
|
||||
const errorMsg =
|
||||
(err as { response?: { data?: { message?: string } } })?.response?.data?.message || '操作失败';
|
||||
message.error(errorMsg);
|
||||
handleApiError(err, '操作失败');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user