diff --git a/src/components/Authorized/CheckPermissions.js b/src/components/Authorized/CheckPermissions.js index 0a7dbaedf7d9c99b8f0d17cfd517f1b42325cdd2..7a8239c26c12066628aca000f211e16352030ddb 100644 --- a/src/components/Authorized/CheckPermissions.js +++ b/src/components/Authorized/CheckPermissions.js @@ -38,9 +38,7 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => { // Promise 处理 if (isPromise(authority)) { - return () => ( - - ); + return ; } // Function 处理 diff --git a/src/components/Authorized/PromiseRender.js b/src/components/Authorized/PromiseRender.js index 78f762d92870fa282bb5b64ec2de9ef1d76d221c..06975f8ae7aa569bb4abcd287235e16ab32c8327 100644 --- a/src/components/Authorized/PromiseRender.js +++ b/src/components/Authorized/PromiseRender.js @@ -3,9 +3,9 @@ import { Spin } from 'antd'; export default class PromiseRender extends React.PureComponent { state = { - component: false, + component: null, }; - async componentDidMount() { + componentDidMount() { this.props.promise .then(() => { this.setState({ @@ -14,7 +14,7 @@ export default class PromiseRender extends React.PureComponent { }) .catch(() => { this.setState({ - component: this.props.error, + component: () => this.props.error, }); }); } diff --git a/src/components/Authorized/Secured.js b/src/components/Authorized/Secured.js index 1dc6fb17bbac979bbb5815a416bba23ee8c8532f..c6d7468c2312e3a6483c4afae874881831d28e84 100644 --- a/src/components/Authorized/Secured.js +++ b/src/components/Authorized/Secured.js @@ -38,7 +38,7 @@ const authorize = (authority, error) => { throw new Error('authority is required'); } return function decideAuthority(targer) { - return CheckPermissions( + return () => CheckPermissions( authority, targer, classError || Exception403 diff --git a/src/router.js b/src/router.js index 54eefd1702fc5b99c336fb5a82c9c7d1005f0215..23fdae17c321d284205ebdec29704cbfaed61c4c 100644 --- a/src/router.js +++ b/src/router.js @@ -1,5 +1,5 @@ import React from 'react'; -import { routerRedux, Switch } from 'dva/router'; +import { routerRedux, Route, Switch } from 'dva/router'; import { LocaleProvider, Spin } from 'antd'; import zhCN from 'antd/lib/locale-provider/zh_CN'; import dynamic from 'dva/dynamic'; @@ -21,10 +21,9 @@ function RouterConfig({ history, app }) { - } - redirectPath="/" + component={UserLayout} />