2025-01-11 06:23:01 +08:00
|
|
|
import { mainApi } from '../../buster';
|
|
|
|
import { GetPermissionGroupResponse } from './responseInterfaces';
|
|
|
|
|
|
|
|
export const listPermissionGroups = async (): Promise<GetPermissionGroupResponse[]> => {
|
|
|
|
return await mainApi.get(`/permission_groups`).then((res) => res.data);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getPermissionGroup = async ({
|
|
|
|
id
|
|
|
|
}: {
|
|
|
|
id: string;
|
|
|
|
}): Promise<GetPermissionGroupResponse> => {
|
|
|
|
return await mainApi.get(`/permission_groups/${id}`).then((res) => res.data);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const updatePermissionGroup = async ({
|
|
|
|
id,
|
|
|
|
data
|
|
|
|
}: {
|
|
|
|
id: string;
|
|
|
|
data: { id: string; name: string }[];
|
|
|
|
}): Promise<void> => {
|
2025-01-11 06:54:39 +08:00
|
|
|
return await mainApi.put(`/permission_groups/${id}`, data).then((res) => res.data);
|
2025-01-11 06:23:01 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
export const deletePermissionGroup = async ({ id }: { id: string }): Promise<void> => {
|
2025-01-11 06:54:39 +08:00
|
|
|
return await mainApi.delete(`/permission_groups/${id}`).then((res) => res.data);
|
2025-01-11 06:23:01 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
export const createPermissionGroup = async (data: { name: string }): Promise<void> => {
|
2025-01-11 06:54:39 +08:00
|
|
|
return await mainApi.post(`/permission_groups`, data).then((res) => res.data);
|
2025-01-11 06:23:01 +08:00
|
|
|
};
|