fleet/frontend/router/index.jsx

55 lines
2.2 KiB
React
Raw Normal View History

import React from 'react';
import { browserHistory, IndexRoute, Route, Router } from 'react-router';
import { Provider } from 'react-redux';
2016-09-07 00:04:02 +00:00
import { syncHistoryWithStore } from 'react-router-redux';
import AdminUserManagementPage from '../pages/Admin/UserManagementPage';
import App from '../components/App';
import AuthenticatedAdminRoutes from '../components/AuthenticatedAdminRoutes';
import AuthenticatedRoutes from '../components/AuthenticatedRoutes';
import CoreLayout from '../layouts/CoreLayout';
import ForgotPasswordPage from '../pages/ForgotPasswordPage';
import HomePage from '../pages/HomePage';
import LoginRoutes from '../components/LoginRoutes';
import LogoutPage from '../pages/LogoutPage';
import ManageHostsPage from '../pages/hosts/ManageHostsPage';
import NewHostPage from '../pages/hosts/NewHostPage';
import QueryPage from '../pages/queries/QueryPage';
import QueryPageWrapper from '../components/queries/QueryPageWrapper';
import ResetPasswordPage from '../pages/ResetPasswordPage';
2016-09-07 00:04:02 +00:00
import store from '../redux/store';
2016-09-06 18:41:16 +00:00
2016-09-07 00:04:02 +00:00
const history = syncHistoryWithStore(browserHistory, store);
2016-09-07 00:04:02 +00:00
const routes = (
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<Route path="login" component={LoginRoutes}>
<Route path="forgot" component={ForgotPasswordPage} />
<Route path="reset" component={ResetPasswordPage} />
</Route>
<Route component={AuthenticatedRoutes}>
<Route path="logout" component={LogoutPage} />
<Route component={CoreLayout}>
<IndexRoute component={HomePage} />
<Route path="admin" component={AuthenticatedAdminRoutes}>
<Route path="users" component={AdminUserManagementPage} />
</Route>
<Route path="queries" component={QueryPageWrapper}>
<Route path="new" component={QueryPage} />
<Route path=":id" component={QueryPage} />
</Route>
<Route path="hosts">
<Route path="new" component={NewHostPage} />
<Route path="manage" component={ManageHostsPage} />
</Route>
</Route>
</Route>
</Route>
</Router>
</Provider>
2016-09-07 00:04:02 +00:00
);
2016-09-07 00:04:02 +00:00
export default routes;