Ajout component AuthorizedRoute
This commit is contained in:
parent
7bc10ae2b9
commit
29e112ae7d
@ -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>
|
||||||
|
7
frontend/src/components/AuthorizedRoute.js
Normal file
7
frontend/src/components/AuthorizedRoute.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { Route } from 'react-router';
|
||||||
|
|
||||||
|
export function AuthorizedRoute({...props}) {
|
||||||
|
return (
|
||||||
|
<Route {...props} />
|
||||||
|
)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user