import { axios } from "./BaseAPI"; import type { ModuleCode, Page, PageResult, Permission, PermissionPayload } from "../types"; const BASE_URI = "/user/permission"; async function list(req: Page): Promise> { return axios.post(`${BASE_URI}/list`, req); } async function create(req: PermissionPayload): Promise { return axios.post(`${BASE_URI}/create`, req); } async function update(req: PermissionPayload): Promise { return axios.post(`${BASE_URI}/update`, req); } async function remove(id: string): Promise { return axios.post(`${BASE_URI}/delete`, undefined, { params: { id } }); } /** 查询当前登录用户在指定模块内可转授的权限。 */ async function grantableList(moduleCode: ModuleCode): Promise { return await axios.post(`${BASE_URI}/grantable/list`, undefined, { params: { moduleCode } }); } export default { list, create, update, remove, grantableList };