refactor(web): 前端错误处理统一化 — 9 个文件 13 处替换 handleApiError
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

统一使用 api/client.ts 的 handleApiError() 替代内联错误提取:
- Login/Users/Roles/Organizations/Settings 操作失败提示
- ArticleEditor/ArticleTagManage/ArticleCategoryManage 表单错误
- FamilyMembersTab 家庭成员操作

零 response?.data?.message 内联模式残留
This commit is contained in:
iven
2026-05-03 19:59:12 +08:00
parent 443bfbae61
commit 0d3e45300f
9 changed files with 23 additions and 47 deletions

View File

@@ -2,6 +2,7 @@ import { useCallback, useEffect, useState } from 'react';
import { Table, Button, Form, Input, Select, Drawer, message, Popconfirm, Space } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { patientApi, type FamilyMember, type CreateFamilyMemberReq } from '../../../api/health/patients';
import { handleApiError } from '../../../api/client';
import { AuthButton } from '../../../components/AuthButton';
import { useDictionary } from '../../../hooks/useDictionary';
@@ -52,8 +53,7 @@ export function FamilyMembersTab({ patientId }: Props) {
form.resetFields();
fetchMembers();
} catch (err: unknown) {
const msg = (err as { response?: { data?: { message?: string } } })?.response?.data?.message || '操作失败';
message.error(msg);
handleApiError(err, '操作失败');
}
};