Преглед изворни кода

improve a conditional branch

WNomunomu пре 2 година
родитељ
комит
ad56174f85
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      apps/app/src/stores/context.tsx

+ 1 - 1
apps/app/src/stores/context.tsx

@@ -232,7 +232,7 @@ export const useIsReadOnlyUser = (): SWRResponse<boolean, Error> => {
 export const useIsAdmin = (): SWRResponse<boolean, Error> => {
 export const useIsAdmin = (): SWRResponse<boolean, Error> => {
   const { data: currentUser, isLoading } = useCurrentUser();
   const { data: currentUser, isLoading } = useCurrentUser();
 
 
-  const isAdminUser = currentUser?.admin !== undefined ? currentUser.admin : false;
+  const isAdminUser = currentUser != null ? currentUser.admin : false;
 
 
   return useSWRImmutable(
   return useSWRImmutable(
     isLoading ? null : ['isAdminUser', currentUser?._id],
     isLoading ? null : ['isAdminUser', currentUser?._id],