task-90(店铺中心): 实现店铺分组选项加载
新增 shop-group-model.ts(ShopManageGroupItemVo 下拉项解析) 并在 shop-manage-api.ts 增加 fetchShopManageGroups(GET /api/admin/shop-manages/groups, 后端限定普通管理员可访问分组)。 TDD: task-90.test.ts 8 用例先 RED 后 GREEN。
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
/** 店铺列表加载适配(任务 88):GET /api/admin/shop-manages + 分页/筛选归一与解析。 */
|
||||
/** 店铺列表加载与分组选项适配(任务 88/90):GET /api/admin/shop-manages(/groups) + 归一与解析。 */
|
||||
import { http } from '@/api/http'
|
||||
import { parseShopManagePage } from './shop-manage-model.ts'
|
||||
import { parseShopManageGroups } from './shop-group-model.ts'
|
||||
import {
|
||||
normalizeShopListParams,
|
||||
toShopManagePageQuery,
|
||||
type ShopGroupOption,
|
||||
type ShopManageListParams,
|
||||
type ShopPageResult,
|
||||
} from './shop-dto.ts'
|
||||
@@ -15,3 +17,11 @@ export async function fetchShopManageList(params: Partial<ShopManageListParams>
|
||||
const { data } = await http.get<unknown>(SHOP_MANAGE_ENDPOINT, { params: toShopManagePageQuery(normalized) })
|
||||
return parseShopManagePage(data)
|
||||
}
|
||||
|
||||
export const SHOP_MANAGE_GROUPS_ENDPOINT = '/api/admin/shop-manages/groups'
|
||||
|
||||
/** 加载店铺分组下拉选项(超级管理员取全部,普通管理员由后端限定可访问分组)。 */
|
||||
export async function fetchShopManageGroups(): Promise<ShopGroupOption[]> {
|
||||
const { data } = await http.get<unknown>(SHOP_MANAGE_GROUPS_ENDPOINT)
|
||||
return parseShopManageGroups(data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user