Ajout component AuthorizedRoute

This commit is contained in:
wpetit 2020-03-26 13:46:25 +01:00
parent 7bc10ae2b9
commit 29e112ae7d
2 changed files with 9 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import DashBoardDev from './pages/DashBoardDev';
import { ConnectedLogoutPage as LogoutPage } from './pages/logout'; import { ConnectedLogoutPage as LogoutPage } from './pages/logout';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { history } from './util/history'; import { history } from './util/history';
import { AuthorizedRoute } from './components/AuthorizedRoute';
const LazyHomePage = React.lazy(() => import('./pages/home.lazy')); const LazyHomePage = React.lazy(() => import('./pages/home.lazy'));
@ -22,7 +23,7 @@ export class App extends Component {
<Route path='/logout' exact component={LogoutPage} /> <Route path='/logout' exact component={LogoutPage} />
<Route path='/home' exact component={LazyHomePage} /> <Route path='/home' exact component={LazyHomePage} />
<Route path='/dashboard-client' exact component={DashBoardClient} /> <Route path='/dashboard-client' exact component={DashBoardClient} />
<Route path='/dashboard-dev' exact component={DashBoardDev} /> <AuthorizedRoute path='/dashboard-dev' exact component={DashBoardDev} />
<Route component={() => <Redirect to="/home" />} /> <Route component={() => <Redirect to="/home" />} />
</Switch> </Switch>
</HashRouter> </HashRouter>

View File

@ -0,0 +1,7 @@
import { Route } from 'react-router';
export function AuthorizedRoute({...props}) {
return (
<Route {...props} />
)
}