From d301e01a9ff12cb2e8bc72327a909f19f4ea60ac Mon Sep 17 00:00:00 2001 From: chenshuai2144 Date: Mon, 29 Jun 2020 17:49:47 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=8C=20versions:=20up=20@umijs/fabric?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- .../Authorized/CheckPermissions.tsx | 20 ++++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) 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'); }; -- GitLab