From 5fb5a0bc5f5824b0ea0006de01e21b89959f4182 Mon Sep 17 00:00:00 2001 From: Anass Bouassaba Date: Sat, 30 Nov 2024 07:59:28 +0100 Subject: [PATCH] refactor(ui): better variable names --- ui/src/components/sharing/sharing-groups.tsx | 12 +- ui/src/components/sharing/sharing-users.tsx | 136 +++++++++---------- 2 files changed, 73 insertions(+), 75 deletions(-) diff --git a/ui/src/components/sharing/sharing-groups.tsx b/ui/src/components/sharing/sharing-groups.tsx index 420bc5323..07fc89e0d 100644 --- a/ui/src/components/sharing/sharing-groups.tsx +++ b/ui/src/components/sharing/sharing-groups.tsx @@ -55,7 +55,7 @@ const SharingGroups = () => { const dispatch = useAppDispatch() const selection = useAppSelector((state) => state.ui.files.selection) const mutateFiles = useAppSelector((state) => state.ui.files.mutate) - const [isGrantLoading, setIsGrantLoading] = useState(false) + const [isGranting, setIsGranting] = useState(false) const [revokedPermission, setRevokedPermission] = useState() const [group, setGroup] = useState() const [permission, setPermission] = useState() @@ -77,23 +77,23 @@ const SharingGroups = () => { const handleGrantPermission = useCallback(async () => { if (group && permission) { try { - setIsGrantLoading(true) + setIsGranting(true) await FileAPI.grantGroupPermission({ ids: selection, groupId: group.id, - permission: permission, + permission, }) await mutateFiles?.() if (isSingleSelection) { await mutatePermissions() } setGroup(undefined) - setIsGrantLoading(false) + setIsGranting(false) if (!isSingleSelection) { dispatch(sharingModalDidClose()) } } catch { - setIsGrantLoading(false) + setIsGranting(false) } } }, [ @@ -153,7 +153,7 @@ const SharingGroups = () => {