Explorar el Código

fix chechPermissions.js isPromise(bool)

guowenfh hace 7 años
padre
commit
e685dc6881
Se han modificado 1 ficheros con 4 adiciones y 4 borrados
  1. 4 4
      src/components/Authorized/CheckPermissions.js

+ 4 - 4
src/components/Authorized/CheckPermissions.js

@@ -49,11 +49,11 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => {
   if (typeof authority === 'function') {
     try {
       const bool = authority(currentAuthority);
+      // 函数执行后返回值是 Promise
+      if (isPromise(bool)) {
+        return <PromiseRender ok={target} error={Exception} promise={bool} />;
+      }
       if (bool) {
-        // 函数执行后返回值是 Promise
-        if (isPromise(bool)) {
-          return <PromiseRender ok={target} error={Exception} promise={bool} />;
-        }
         return target;
       }
       return Exception;