2016-01-03 01:54:07 +05:30
|
|
|
import React from 'react';
|
|
|
|
import { Route, IndexRoute } from 'react-router';
|
|
|
|
|
2016-01-04 02:48:42 +05:30
|
|
|
import RootPage from 'pages/root/RootPage';
|
|
|
|
import IndexPage from 'pages/index/IndexPage';
|
2016-01-16 17:36:22 +05:30
|
|
|
import AuthPage from 'pages/auth/AuthPage';
|
|
|
|
|
|
|
|
import Register from 'components/auth/Register';
|
|
|
|
import Login from 'components/auth/Login';
|
|
|
|
import Permissions from 'components/auth/Permissions';
|
|
|
|
import Activation from 'components/auth/Activation';
|
|
|
|
import Password from 'components/auth/Password';
|
2016-01-03 01:54:07 +05:30
|
|
|
|
2016-01-18 10:58:43 +05:30
|
|
|
function requireAuth(nextState, replace) {
|
|
|
|
// if (!auth.loggedIn()) {
|
|
|
|
replace({
|
|
|
|
pathname: '/login',
|
|
|
|
state: {
|
|
|
|
nextPathname: nextState.location.pathname
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
2016-01-03 01:54:07 +05:30
|
|
|
export default (
|
2016-01-04 02:48:42 +05:30
|
|
|
<Route path="/" component={RootPage}>
|
2016-01-18 10:58:43 +05:30
|
|
|
<IndexRoute component={IndexPage} onEnter={requireAuth} />
|
2016-01-16 17:36:22 +05:30
|
|
|
|
|
|
|
<Route path="auth" component={AuthPage}>
|
2016-01-31 18:29:38 +05:30
|
|
|
<Route path="/login" components={new Login()} />
|
|
|
|
<Route path="/password" components={new Password()} />
|
|
|
|
<Route path="/register" components={new Register()} />
|
|
|
|
<Route path="/activation" components={new Activation()} />
|
|
|
|
<Route path="/oauth/permissions" components={new Permissions()} />
|
2016-01-16 17:36:22 +05:30
|
|
|
<Route path="/oauth/:id" component={Permissions} />
|
|
|
|
</Route>
|
2016-01-03 01:54:07 +05:30
|
|
|
</Route>
|
|
|
|
);
|