@@ -2,7 +2,7 @@ import './AppLayout.less';
22
33import * as React from 'react' ;
44
5- import { Redirect , Switch } from 'react-router-dom' ;
5+ import { Redirect , Switch , Route } from 'react-router-dom' ;
66
77import DocumentTitle from 'react-document-title' ;
88import Footer from '../../components/Footer' ;
@@ -12,6 +12,7 @@ import ProtectedRoute from '../../components/Router/ProtectedRoute';
1212import SiderMenu from '../../components/SiderMenu' ;
1313import { appRouters } from '../Router/router.config' ;
1414import utils from '../../utils/utils' ;
15+ import NotFoundRoute from '../Router/NotFoundRoute' ;
1516
1617const { Content } = Layout ;
1718
@@ -48,13 +49,18 @@ class AppLayout extends React.Component<any> {
4849 </ Layout . Header >
4950 < Content style = { { margin : 16 } } >
5051 < Switch >
52+ { this . props . location . pathname === '/' && < Redirect from = "/" to = "/dashboard" /> }
5153 { appRouters
5254 . filter ( ( item : any ) => ! item . isLayout )
5355 . map ( ( route : any , index : any ) => (
54- < ProtectedRoute key = { index } path = { route . path } component = { route . component } permission = { route . permission } />
56+ < Route
57+ exact
58+ key = { index }
59+ path = { route . path }
60+ render = { props => < ProtectedRoute component = { route . component } permission = { route . permission } /> }
61+ />
5562 ) ) }
56-
57- < Redirect from = "/" to = "/dashboard" />
63+ { pathname !== '/' && < NotFoundRoute /> }
5864 </ Switch >
5965 </ Content >
6066 < Layout . Footer style = { { textAlign : 'center' } } >
0 commit comments