Blame view
imports/startup/client/routes.jsx
1.5 KB
2b1ad7917
|
1 2 3 4 5 6 7 8 |
import React from 'react'; import { render } from 'react-dom'; import { Router, Route, Redirect, IndexRoute, browserHistory } from 'react-router'; import { App } from '../../ui/layouts/app'; import { Dashboard } from '../../ui/pages/dashboard'; import { Index } from '../../ui/pages/index'; import { Login } from '../../ui/pages/login'; |
c23f29749
|
9 |
import { NotFound } from '../../ui/pages/not-found'; |
2b1ad7917
|
10 11 12 13 14 15 16 17 18 19 20 21 |
import { RecoverPassword } from '../../ui/pages/recover-password'; import { ResetPassword } from '../../ui/pages/reset-password'; import { Signup } from '../../ui/pages/signup'; const requireAuth = ( nextState, replace ) => { if ( !Meteor.loggingIn() && !Meteor.user() ) { replace({ pathname: '/login', state: { nextPathName: nextState.location.pathname } }); } }; |
2b1ad7917
|
22 |
Meteor.startup( () => { |
2b1ad7917
|
23 24 25 |
render( <Router history={ browserHistory }> <Route path="/" component={ App }> |
7df77f0fa
|
26 27 28 29 30 31 |
<IndexRoute name="index" component={ Index } onEnter={ requireAuth } /> <Route name="dashboard" path="/dashboard" component={ Dashboard } onEnter={ requireAuth } /> <Route name="login" path="/login" component={ Login } /> <Route name="recover-password" path="/recover-password" component={ RecoverPassword } /> <Route name="reset-password" path="/reset-password/:token" component={ ResetPassword } /> <Route name="signup" path="/signup" component={ Signup } /> |
c23f29749
|
32 |
<Route path="*" component={ NotFound } /> |
2b1ad7917
|
33 34 35 36 37 |
</Route> </Router>, document.getElementById( 'react-root' ) ); }); |