소스 검색

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> => {
   const { data: currentUser, isLoading } = useCurrentUser();
 
-  const isAdminUser = currentUser?.admin !== undefined ? currentUser.admin : false;
+  const isAdminUser = currentUser != null ? currentUser.admin : false;
 
   return useSWRImmutable(
     isLoading ? null : ['isAdminUser', currentUser?._id],