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 RulesPage from 'pages/rules/RulesPage'; import PageNotFound from 'pages/404/PageNotFound'; import ProfilePage from 'pages/profile/ProfilePage'; import ProfileChangePasswordPage from 'pages/profile/ChangePasswordPage'; import ProfileChangeUsernamePage from 'pages/profile/ChangeUsernamePage'; import ProfileChangeEmailPage from 'pages/profile/ChangeEmailPage'; import OAuthInit from 'components/auth/OAuthInit'; import Register from 'components/auth/register/Register'; import Login from 'components/auth/login/Login'; import Permissions from 'components/auth/permissions/Permissions'; import Activation from 'components/auth/activation/Activation'; import ResendActivation from 'components/auth/resendActivation/ResendActivation'; import Password from 'components/auth/password/Password'; import ChangePassword from 'components/auth/changePassword/ChangePassword'; import ForgotPassword from 'components/auth/forgotPassword/ForgotPassword'; import RecoverPassword from 'components/auth/recoverPassword/RecoverPassword'; import Finish from 'components/auth/finish/Finish'; import authFlow from 'services/authFlow'; export default function routesFactory(store) { authFlow.setStore(store); const startAuthFlow = { onEnter: ({location}, replace, callback) => authFlow.handleRequest(location.pathname, replace, callback) }; const userOnly = { onEnter: ({location}, replace) => { const {user} = store.getState(); if (user.isGuest) { replace('/'); } } }; return ( ); }