diff --git a/src/components/Authorized/CheckPermissions.js b/src/components/Authorized/CheckPermissions.js index c1d6647dd679b57736cf68246fb02592e9c4b800..a62deed48738ba915a4732af995eceb99c066d0d 100644 --- a/src/components/Authorized/CheckPermissions.js +++ b/src/components/Authorized/CheckPermissions.js @@ -1,6 +1,11 @@ import React from 'react'; import PromiseRender from './PromiseRender'; import { CURRENT } from './index'; + +function isPromise(obj) { + return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'; +} + /** * 通用权限检查方法 * Common check permissions method @@ -32,7 +37,7 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => { } // Promise 处理 - if (authority.constructor.name === 'Promise') { + if (isPromise(authority)) { return () => ( );