From ed463d67ab21ebf012e511d453e05cd2c5d72f6f Mon Sep 17 00:00:00 2001 From: hailin Date: Fri, 2 Jan 2026 19:08:57 -0800 Subject: [PATCH] fix(admin-web): fix API response data access in pendingActionService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The apiClient interceptor already unwraps response.data, so the service was accessing .data on the already-unwrapped response. Fixed by properly casting the response type to access the nested data field. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../src/services/pendingActionService.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/frontend/admin-web/src/services/pendingActionService.ts b/frontend/admin-web/src/services/pendingActionService.ts index fff8f15b..c36f36e0 100644 --- a/frontend/admin-web/src/services/pendingActionService.ts +++ b/frontend/admin-web/src/services/pendingActionService.ts @@ -24,16 +24,17 @@ export const pendingActionService = { * 查询待办操作列表 */ async getList(params: QueryPendingActionsParams = {}): Promise { - const response = await apiClient.get(API_ENDPOINTS.PENDING_ACTIONS.LIST, { params }); - return response.data; + // apiClient 拦截器已返回 response.data,这里直接返回 + const data = await apiClient.get(API_ENDPOINTS.PENDING_ACTIONS.LIST, { params }); + return (data as { data: PendingActionListResponse }).data; }, /** * 获取单个待办操作详情 */ async getDetail(id: string): Promise { - const response = await apiClient.get(API_ENDPOINTS.PENDING_ACTIONS.DETAIL(id)); - return response.data; + const data = await apiClient.get(API_ENDPOINTS.PENDING_ACTIONS.DETAIL(id)); + return (data as { data: PendingAction }).data; }, /** @@ -41,7 +42,7 @@ export const pendingActionService = { */ async create(data: CreatePendingActionRequest): Promise { const response = await apiClient.post(API_ENDPOINTS.PENDING_ACTIONS.CREATE, data); - return response.data; + return (response as { data: PendingAction }).data; }, /** @@ -49,7 +50,7 @@ export const pendingActionService = { */ async batchCreate(data: BatchCreatePendingActionRequest): Promise { const response = await apiClient.post(API_ENDPOINTS.PENDING_ACTIONS.BATCH_CREATE, data); - return response.data; + return (response as { data: BatchCreateResult }).data; }, /** @@ -57,7 +58,7 @@ export const pendingActionService = { */ async update(id: string, data: UpdatePendingActionRequest): Promise { const response = await apiClient.put(API_ENDPOINTS.PENDING_ACTIONS.UPDATE(id), data); - return response.data; + return (response as { data: PendingAction }).data; }, /** @@ -65,7 +66,7 @@ export const pendingActionService = { */ async cancel(id: string): Promise { const response = await apiClient.post(API_ENDPOINTS.PENDING_ACTIONS.CANCEL(id)); - return response.data; + return (response as { data: PendingAction }).data; }, /**