|
@@ -1,8 +1,10 @@
|
|
|
import React from 'react'
|
|
import React from 'react'
|
|
|
import { Layout } from 'antd'
|
|
import { Layout } from 'antd'
|
|
|
import { Route, Switch } from 'dva/router'
|
|
import { Route, Switch } from 'dva/router'
|
|
|
|
|
+import { Redirect } from 'dva/router'
|
|
|
import Navigator from '../components/common/navigator'
|
|
import Navigator from '../components/common/navigator'
|
|
|
import HomePage from '../components/homePage/homePage'
|
|
import HomePage from '../components/homePage/homePage'
|
|
|
|
|
+import Login from '../components/common/login/login'
|
|
|
import Loading from '../components/common/loading/loading'
|
|
import Loading from '../components/common/loading/loading'
|
|
|
import DataSourceDetail from '../components/datasource/dataSourceDetail'
|
|
import DataSourceDetail from '../components/datasource/dataSourceDetail'
|
|
|
import DataSource from '../components/datasource/dataSource'
|
|
import DataSource from '../components/datasource/dataSource'
|
|
@@ -13,7 +15,7 @@ import Demo from '../demo';
|
|
|
import Admin from '../components/admin/admin';
|
|
import Admin from '../components/admin/admin';
|
|
|
const { Header, Content } = Layout
|
|
const { Header, Content } = Layout
|
|
|
|
|
|
|
|
-const MainLayout = (history) => {
|
|
|
|
|
|
|
+const MainLayout = ({ isAuthenticated }) => {
|
|
|
return(
|
|
return(
|
|
|
<Layout className='main-layout'>
|
|
<Layout className='main-layout'>
|
|
|
<Loading />
|
|
<Loading />
|
|
@@ -29,7 +31,12 @@ const MainLayout = (history) => {
|
|
|
<Route sensitive path='/dashboard' component={Dashboard} />
|
|
<Route sensitive path='/dashboard' component={Dashboard} />
|
|
|
<Route sensitive path='/chart' component={Chart} />
|
|
<Route sensitive path='/chart' component={Chart} />
|
|
|
<Route sensitive path='/admin' component={Admin} />
|
|
<Route sensitive path='/admin' component={Admin} />
|
|
|
- <Route path='/' component={HomePage}/>
|
|
|
|
|
|
|
+ <Route path='/' component={isAuthenticated ? HomePage : () => <Redirect
|
|
|
|
|
+ to={{
|
|
|
|
|
+ pathname: "/login",
|
|
|
|
|
+ state: { from: '/' }
|
|
|
|
|
+ }}
|
|
|
|
|
+ />}/>
|
|
|
</Switch>
|
|
</Switch>
|
|
|
</Content>
|
|
</Content>
|
|
|
</Layout>
|
|
</Layout>
|