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:
parent
8c8a049f77
commit
ed463d67ab
|
|
@ -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;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue