Skip to content

Commit

Permalink
fix(用户登录): 权限缓存问题
Browse files Browse the repository at this point in the history
渲染菜单时,先调用reloadAuthorized方法

re #211
  • Loading branch information
Lind-pro committed Sep 24, 2020
1 parent 46f1161 commit e91d298
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/layouts/BasicLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Link } from 'umi';
import { Dispatch } from 'redux';
import { connect } from 'dva';
import { Result, Button } from 'antd';
import Authorized from '@/utils/Authorized';
import Authorized, { reloadAuthorized } from '@/utils/Authorized';
import RightContent from '@/components/GlobalHeader/RightContent';
import { ConnectState } from '@/models/connect';
import { isAntDesignPro, getAuthorityFromRouter } from '@/utils/utils';
Expand Down Expand Up @@ -58,6 +58,7 @@ export type BasicLayoutContext = { [K in 'location']: BasicLayoutProps[K] } & {
const menuDataRender = (menuList: MenuDataItem[]): MenuDataItem[] => {
const version = localStorage.getItem('system-version');
const tenant = localStorage.getItem('tenants-admin');
reloadAuthorized();
if (tenant === 'true') {
return menuList.filter(j => j.tenant).filter(i => i.tenant.indexOf('admin') > -1).map(item => {
const localItem: any = {
Expand Down Expand Up @@ -136,6 +137,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
} = props;



useEffect(() => {
if (dispatch) {
dispatch({
Expand All @@ -154,7 +156,6 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
}
}; // get children authority


const authorized = getAuthorityFromRouter(props.route.routes, location.pathname || '/') || {
authority: undefined,
};
Expand Down

0 comments on commit e91d298

Please sign in to comment.