瀏覽代碼

improve a conditional branch

WNomunomu 3 年之前
父節點
當前提交
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],