ims-front/src/api/acl/mods/permission/batchInitPermissions.ts
2024-12-01 19:02:48 +08:00

23 lines
640 B
TypeScript

/**
* @desc 批量新增权限
*/
import { defaultSuccess, defaultError, http } from '@/plugins/axios';
import type { AxiosResponse } from 'axios';
export default async function (
/** 请求体 */
requestBody: Array<acl.Permission>,
success: (data: void) => void = defaultSuccess,
fail: (error: { code: string; error?: string }) => void = defaultError,
): Promise<void> {
return http({
method: 'post',
url: `/batch-init-permissions`,
data: requestBody,
})
.then((data: AxiosResponse<void, unknown>) => {
success(data.data);
})
.catch((error: { code: string; error?: string }) => fail(error));
}