Unverified Commit aa675880 authored by ddcat1115's avatar ddcat1115 Committed by GitHub

fix redirect loop (#1103)

* fix redirect loop #1098

* remove useless param
parent 5519345b
...@@ -17,7 +17,7 @@ import { getMenuData } from '../common/menu'; ...@@ -17,7 +17,7 @@ import { getMenuData } from '../common/menu';
import logo from '../assets/logo.svg'; import logo from '../assets/logo.svg';
const { Content, Header, Footer } = Layout; const { Content, Header, Footer } = Layout;
const { AuthorizedRoute } = Authorized; const { AuthorizedRoute, check } = Authorized;
/** /**
* 根据菜单取得重定向地址. * 根据菜单取得重定向地址.
...@@ -109,7 +109,11 @@ class BasicLayout extends React.PureComponent { ...@@ -109,7 +109,11 @@ class BasicLayout extends React.PureComponent {
urlParams.searchParams.delete('redirect'); urlParams.searchParams.delete('redirect');
window.history.replaceState(null, 'redirect', urlParams.href); window.history.replaceState(null, 'redirect', urlParams.href);
} else { } else {
return '/dashboard/analysis'; const { routerData } = this.props;
// get the first authorized route path in routerData
const authorizedPath = Object.keys(routerData).find(item =>
check(routerData[item].authority, item) && item !== '/');
return authorizedPath;
} }
return redirect; return redirect;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment