diff --git a/package.json b/package.json index 97c3f3d1..521ead9d 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "@types/react": "^16.9.17", "@types/react-dom": "^16.8.4", "@types/react-helmet": "^5.0.13", - "@umijs/fabric": "^2.0.5", + "@umijs/fabric": "^2.2.0", "@umijs/plugin-blocks": "^2.0.5", "@umijs/preset-ant-design-pro": "^1.2.0", "@umijs/preset-react": "^1.4.8", diff --git a/src/components/Authorized/CheckPermissions.tsx b/src/components/Authorized/CheckPermissions.tsx index ff35f60f..887bcc10 100644 --- a/src/components/Authorized/CheckPermissions.tsx +++ b/src/components/Authorized/CheckPermissions.tsx @@ -57,19 +57,15 @@ const checkPermissions = ( } // Function 处理 if (typeof authority === 'function') { - try { - const bool = authority(currentAuthority); - // 函数执行后返回值是 Promise - if (bool instanceof Promise) { - return ok={target} error={Exception} promise={bool} />; - } - if (bool) { - return target; - } - return Exception; - } catch (error) { - throw error; + const bool = authority(currentAuthority); + // 函数执行后返回值是 Promise + if (bool instanceof Promise) { + return ok={target} error={Exception} promise={bool} />; } + if (bool) { + return target; + } + return Exception; } throw new Error('unsupported parameters'); };