chore: update eslint and prettier configuration
This commit is contained in:
@@ -61,7 +61,9 @@ export function useRoleForm({
|
||||
const roleName = useWatch({ control, name: 'name' }) || '';
|
||||
const displayName = useWatch({ control, name: 'display_name' }) || '';
|
||||
const canSubmit =
|
||||
roleName.trim().length > 0 && displayName.trim().length > 0 && permissionIds.length > 0;
|
||||
roleName.trim().length > 0 &&
|
||||
displayName.trim().length > 0 &&
|
||||
permissionIds.length > 0;
|
||||
|
||||
const saveMutation = useMutation({
|
||||
mutationFn: (values: RoleFormValues) =>
|
||||
@@ -81,7 +83,9 @@ export function useRoleForm({
|
||||
queryClient.invalidateQueries({ queryKey: roleKeys.all });
|
||||
},
|
||||
onError: (_error, values) => {
|
||||
toast.error(values.id ? 'Failed to update role' : 'Failed to create role');
|
||||
toast.error(
|
||||
values.id ? 'Failed to update role' : 'Failed to create role',
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -116,14 +120,21 @@ export function useRoleForm({
|
||||
name: role.name || '',
|
||||
display_name: role.display_name || '',
|
||||
description: role.description || '',
|
||||
permission_ids: collectPermissionIdsByKeys(permissionTree, role.permissions || []),
|
||||
permission_ids: collectPermissionIdsByKeys(
|
||||
permissionTree,
|
||||
role.permissions || [],
|
||||
),
|
||||
});
|
||||
},
|
||||
[permissionTree, reset],
|
||||
);
|
||||
|
||||
const setPermissionIds = useCallback(
|
||||
(ids: number[]) => setValue('permission_ids', ids, { shouldDirty: true, shouldValidate: true }),
|
||||
(ids: number[]) =>
|
||||
setValue('permission_ids', ids, {
|
||||
shouldDirty: true,
|
||||
shouldValidate: true,
|
||||
}),
|
||||
[setValue],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user