From 83df42678daa93826aee3bfb61742af5f5babc23 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 31 Aug 2018 12:05:17 +0800 Subject: [PATCH] fix authority --- src/pages/Authorized.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/pages/Authorized.js b/src/pages/Authorized.js index 8b11d923..0b0d6b1b 100644 --- a/src/pages/Authorized.js +++ b/src/pages/Authorized.js @@ -3,22 +3,35 @@ import RenderAuthorized from '@/components/Authorized'; import Exception from '@/components/Exception'; import { matchRoutes } from 'react-router-config'; import uniq from 'lodash/uniq'; +import { formatMessage } from 'umi/locale'; +import Link from 'umi/link'; const Authorized = RenderAuthorized(['admin', 'user']); -const noMatch = ; export default ({ children, route, location }) => { const routes = matchRoutes(route.routes, location.pathname); let authorities = []; routes.forEach(item => { - if (Array.isArray(item.authority)) { - authorities = authorities.concat(item.authority); - } else if (typeof item.authority === 'string') { - authorities.push(item.authority); + if (Array.isArray(item.route.authority)) { + authorities = authorities.concat(item.route.authority); + } else if (typeof item.route.authority === 'string') { + authorities.push(item.route.authority); } }); + const noMatch = ( + + ); return ( - + {children} ); -- GitLab