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

22 lines
579 B
TypeScript

/**
* @desc 删除角色
*/
import { defaultSuccess, defaultError, http } from '@/plugins/axios';
import type { AxiosResponse } from 'axios';
export default async function (
/** 角色key */
key: string,
success: (data: void) => void = defaultSuccess,
fail: (error: { code: string; error?: string }) => void = defaultError,
): Promise<void> {
return http({
method: 'delete',
url: `/role/${key}`,
})
.then((data: AxiosResponse<void, unknown>) => {
success(data.data);
})
.catch((error: { code: string; error?: string }) => fail(error));
}