mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-09-14 07:45:36 +05:30
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import { Route, IndexRoute } from 'react-router';
|
|
|
|
import RootPage from 'pages/root/RootPage';
|
|
import IndexPage from 'pages/index/IndexPage';
|
|
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';
|
|
|
|
function requireAuth(nextState, replace) {
|
|
// if (!auth.loggedIn()) {
|
|
replace({
|
|
pathname: '/login',
|
|
state: {
|
|
nextPathname: nextState.location.pathname
|
|
}
|
|
});
|
|
// }
|
|
}
|
|
|
|
export default (
|
|
<Route path="/" component={RootPage}>
|
|
<IndexRoute component={IndexPage} onEnter={requireAuth} />
|
|
|
|
<Route path="auth" component={AuthPage}>
|
|
<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()} />
|
|
<Route path="/oauth/:id" component={Permissions} />
|
|
</Route>
|
|
</Route>
|
|
);
|