1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00
onion/js/routes.js

83 lines
3.0 KiB
JavaScript
Raw Normal View History

'use strict';
import React from 'react';
2015-10-02 09:48:51 +02:00
import { Route } from 'react-router';
2015-05-18 09:56:16 +02:00
import getPrizeRoutes from './components/whitelabel/prize/prize_routes';
import getWalletRoutes from './components/whitelabel/wallet/wallet_routes';
import App from './components/ascribe_app';
import PieceList from './components/piece_list';
2015-07-08 22:54:07 +02:00
import PieceContainer from './components/ascribe_detail/piece_container';
import EditionContainer from './components/ascribe_detail/edition_container';
2015-06-20 16:43:18 +02:00
import LoginContainer from './components/login_container';
2015-07-17 15:02:44 +02:00
import LogoutContainer from './components/logout_container';
2015-06-20 16:43:18 +02:00
import SignupContainer from './components/signup_container';
2015-06-15 16:56:17 +02:00
import PasswordResetContainer from './components/password_reset_container';
2015-06-20 16:43:18 +02:00
import ContractSettings from './components/ascribe_settings/contract_settings';
import SettingsContainer from './components/ascribe_settings/settings_container';
2015-06-25 14:39:39 +02:00
import CoaVerifyContainer from './components/coa_verify_container';
import ErrorNotFoundPage from './components/error_not_found_page';
2015-06-17 17:48:52 +02:00
import RegisterPiece from './components/register_piece';
import AuthProxyHandler from './components/ascribe_routes/proxy_routes/auth_proxy_handler';
2015-10-06 10:20:36 +02:00
let COMMON_ROUTES = (
2015-10-13 14:19:08 +02:00
<Route path='/' component={App}>
2015-10-12 16:51:03 +02:00
<Route
2015-10-13 15:29:41 +02:00
path='login'
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
2015-10-12 16:51:03 +02:00
<Route
2015-10-13 15:29:41 +02:00
path='register_piece'
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(RegisterPiece)}
2015-10-13 15:29:41 +02:00
headerTitle='+ NEW WORK'/>
2015-10-12 16:51:03 +02:00
<Route
2015-10-13 15:29:41 +02:00
path='collection'
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(PieceList)}
2015-10-13 15:29:41 +02:00
headerTitle='COLLECTION'/>
2015-10-12 16:51:03 +02:00
<Route
2015-10-13 15:29:41 +02:00
path='signup'
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SignupContainer)} />
2015-10-12 16:51:03 +02:00
<Route
2015-10-13 15:29:41 +02:00
path='logout'
2015-10-16 13:01:54 +02:00
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(LogoutContainer)}/>
2015-10-13 15:29:41 +02:00
<Route path='pieces/:pieceId' component={PieceContainer} />
<Route path='editions/:editionId' component={EditionContainer} />
2015-10-12 16:51:03 +02:00
<Route
2015-10-13 15:29:41 +02:00
path='password_reset'
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
2015-10-12 16:51:03 +02:00
<Route
2015-10-13 15:29:41 +02:00
path='settings'
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(SettingsContainer)}/>
2015-10-12 16:51:03 +02:00
<Route
2015-10-13 15:29:41 +02:00
path='contract_settings'
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(ContractSettings)}/>
2015-10-13 15:29:41 +02:00
<Route path='coa_verify' component={CoaVerifyContainer} />
<Route path='*' component={ErrorNotFoundPage} />
2015-05-18 18:00:12 +02:00
</Route>
);
function getRoutes(type, subdomain) {
let routes = null;
2015-07-14 17:41:57 +02:00
if (type === 'prize') {
routes = getPrizeRoutes(COMMON_ROUTES, subdomain);
} else if(type === 'wallet') {
routes = getWalletRoutes(COMMON_ROUTES, subdomain);
} else {
routes = COMMON_ROUTES;
}
return routes;
}
export default getRoutes;