This commit is contained in:
Timi
2026-07-30 18:28:25 +08:00
parent 8b24804b22
commit f0d1090932
21 changed files with 915 additions and 268 deletions
+55
View File
@@ -0,0 +1,55 @@
import { axios } from "./BaseAPI";
import type { Page, PageResult, Permission, Role, RolePayload, UserRoleAuthorizeReq } from "../types";
const BASE_URI = "/user/role";
async function list(req: Page<Role>): Promise<PageResult<Role>> {
return axios.post(`${BASE_URI}/list`, req);
}
async function detail(id: string): Promise<Role> {
return axios.post(`${BASE_URI}/detail`, undefined, {
params: { id }
});
}
async function create(req: RolePayload): Promise<void> {
return axios.post(`${BASE_URI}/create`, req);
}
async function update(req: RolePayload): Promise<void> {
return axios.post(`${BASE_URI}/update`, req);
}
async function remove(id: string): Promise<void> {
return axios.post(`${BASE_URI}/delete`, undefined, {
params: { id }
});
}
async function authorizedList(userId: string): Promise<Role[]> {
return axios.post(`${BASE_URI}/authorized/list`, undefined, {
params: { userId }
});
}
async function authorize(req: UserRoleAuthorizeReq): Promise<void> {
return axios.post(`${BASE_URI}/authorized/create`, req);
}
async function authorizedPermission(userId: string): Promise<Permission[]> {
return axios.post(`${BASE_URI}/authorized/permission`, undefined, {
params: { userId }
});
}
export default {
list,
detail,
create,
update,
remove,
authorizedList,
authorize,
authorizedPermission
};