update
This commit is contained in:
@@ -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
|
||||
};
|
||||
Reference in New Issue
Block a user