Problem 3/4: Add usePermissions hook + PermissionItem/PermissionsResponse interfaces
This commit is contained in:
@@ -81,6 +81,19 @@ export interface Role {
|
||||
field_permissions?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface PermissionItem {
|
||||
key: string;
|
||||
label: string;
|
||||
category: string;
|
||||
plugin_name?: string;
|
||||
}
|
||||
|
||||
export interface PermissionsResponse {
|
||||
system: PermissionItem[];
|
||||
plugins: PermissionItem[];
|
||||
all: PermissionItem[];
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
name: string;
|
||||
display_name?: string;
|
||||
@@ -502,6 +515,13 @@ export function useRoles() {
|
||||
});
|
||||
}
|
||||
|
||||
export function usePermissions() {
|
||||
return useQuery({
|
||||
queryKey: ['permissions'],
|
||||
queryFn: () => apiGet<PermissionsResponse>('/roles/permissions'),
|
||||
});
|
||||
}
|
||||
|
||||
export function useCreateRole() {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
|
||||
Reference in New Issue
Block a user