task-82(店铺中心): 实现店铺密钥列表加载
新增 shop-key-model.ts(ShopKeyPageVo camel 解析、白名单状态归一、snake 兜底) 与 shop-key-api.ts(GET /api/admin/shop-keys 加载适配);纯逻辑解析、 页面不内联请求。 TDD: task-82.test.ts 8 用例先 RED 后 GREEN。
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/** 店铺密钥列表加载适配(任务 82):GET /api/admin/shop-keys + 分页归一与解析。 */
|
||||
import { http } from '@/api/http'
|
||||
import { parseShopKeyPage } from './shop-key-model'
|
||||
import { normalizeKeyListParams, toKeyPageQuery, type ShopKeyListParams, type ShopKeyPageResult } from './shop-dto.ts'
|
||||
|
||||
export const SHOP_KEYS_ENDPOINT = '/api/admin/shop-keys'
|
||||
|
||||
export async function fetchShopKeyList(params: Partial<ShopKeyListParams> = {}): Promise<ShopKeyPageResult> {
|
||||
const normalized = normalizeKeyListParams(params)
|
||||
const { data } = await http.get<unknown>(SHOP_KEYS_ENDPOINT, { params: toKeyPageQuery(normalized) })
|
||||
return parseShopKeyPage(data)
|
||||
}
|
||||
Reference in New Issue
Block a user