fix(admin-web): fix API response data access in pendingActionService

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 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-02 19:08:57 -08:00
parent 8c8a049f77
commit ed463d67ab
1 changed files with 9 additions and 8 deletions

View File

@ -24,16 +24,17 @@ export const pendingActionService = {
*
*/
async getList(params: QueryPendingActionsParams = {}): Promise<PendingActionListResponse> {
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<PendingAction> {
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<PendingAction> {
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<BatchCreateResult> {
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<PendingAction> {
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<PendingAction> {
const response = await apiClient.post(API_ENDPOINTS.PENDING_ACTIONS.CANCEL(id));
return response.data;
return (response as { data: PendingAction }).data;
},
/**