fix(phase4): harden development acceptance adapters

This commit is contained in:
2026-08-24 16:57:25 +08:00
parent 964480a617
commit 37ec787bc1
13 changed files with 83 additions and 44 deletions
@@ -1,6 +1,6 @@
import { overseasHttp } from '@/shared/api/overseasHttp'
import { unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
import type { OverseasPageResult } from './lastMileOrders'
import { normalizeOverseasPage, type OverseasPagePayload } from './lastMileOrders'
export interface CustomerWarehouseDto {
id: string
@@ -44,19 +44,19 @@ export interface UpdatePalletPayload extends SavePalletPayload {
}
export async function listCustomerWarehouses() {
const response = await overseasHttp.get<ApiEnvelope<OverseasPageResult<CustomerWarehouseDto>>, ApiEnvelope<OverseasPageResult<CustomerWarehouseDto>>>(
const response = await overseasHttp.get<ApiEnvelope<OverseasPagePayload<CustomerWarehouseDto>>, ApiEnvelope<OverseasPagePayload<CustomerWarehouseDto>>>(
'/platform/v1/warehouse-admin',
{ params: { page: 1, size: 200 } },
)
return unwrapApiResponse(response)
return normalizeOverseasPage(unwrapApiResponse(response))
}
export async function listPallets(warehouseId: string, query: { page: number; size: number; keyword?: string; palletType?: string; status?: string }) {
const response = await overseasHttp.get<ApiEnvelope<OverseasPageResult<PalletDto>>, ApiEnvelope<OverseasPageResult<PalletDto>>>(
const response = await overseasHttp.get<ApiEnvelope<OverseasPagePayload<PalletDto>>, ApiEnvelope<OverseasPagePayload<PalletDto>>>(
`/platform/v1/warehouse-admin/${encodeURIComponent(warehouseId)}/pallets`,
{ params: { ...query } },
)
return unwrapApiResponse(response)
return normalizeOverseasPage(unwrapApiResponse(response))
}
export async function getPallet(warehouseId: string, palletId: string) {