2015-06-05 11:06:36 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-05-18 13:43:42 +02:00
|
|
|
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
|
|
|
|
2015-08-11 14:47:28 +02:00
|
|
|
import getPrizeRoutes from './components/whitelabel/prize/prize_routes';
|
|
|
|
import getWalletRoutes from './components/whitelabel/wallet/wallet_routes';
|
2015-08-27 14:34:15 +02:00
|
|
|
|
|
|
|
import App from './components/ascribe_app';
|
2015-07-10 16:43:35 +02:00
|
|
|
|
2015-05-19 17:13:09 +02:00
|
|
|
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
|
|
|
|
2015-09-23 15:16:46 +02:00
|
|
|
import ContractSettings from './components/ascribe_settings/contract_settings';
|
2015-08-31 16:36:24 +02:00
|
|
|
import SettingsContainer from './components/ascribe_settings/settings_container';
|
2015-06-25 14:39:39 +02:00
|
|
|
import CoaVerifyContainer from './components/coa_verify_container';
|
|
|
|
|
2015-09-29 16:00:58 +02:00
|
|
|
import ErrorNotFoundPage from './components/error_not_found_page';
|
|
|
|
|
2015-06-17 17:48:52 +02:00
|
|
|
import RegisterPiece from './components/register_piece';
|
2015-07-29 18:03:49 +02:00
|
|
|
|
2015-10-06 10:20:36 +02:00
|
|
|
import ProxyRoute from './components/ascribe_routes/proxy_route';
|
2015-10-06 18:28:15 +02:00
|
|
|
import RedirectProxyHandler from './components/ascribe_routes/proxy_routes/redirect_proxy_handler';
|
2015-10-06 10:20:36 +02:00
|
|
|
|
2015-08-27 14:34:15 +02:00
|
|
|
import AppConstants from './constants/application_constants';
|
|
|
|
|
2015-05-18 09:56:16 +02:00
|
|
|
|
2015-09-30 17:09:46 +02:00
|
|
|
let baseUrl = AppConstants.baseUrl;
|
2015-07-10 16:43:35 +02:00
|
|
|
|
2015-10-06 18:28:15 +02:00
|
|
|
let COMMON_ROUTES = (
|
2015-09-30 17:09:46 +02:00
|
|
|
<Route path={baseUrl} component={App}>
|
2015-10-06 18:28:15 +02:00
|
|
|
<ProxyRoute
|
|
|
|
path="login"
|
|
|
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
|
|
|
component={LoginContainer} />
|
2015-10-07 09:39:30 +02:00
|
|
|
<ProxyRoute
|
|
|
|
path="register_piece"
|
|
|
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
|
|
|
component={RegisterPiece}
|
|
|
|
headerTitle="+ NEW WORK"/>
|
2015-10-09 13:51:21 +02:00
|
|
|
<ProxyRoute
|
|
|
|
path="collection"
|
|
|
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
|
|
|
component={PieceList}
|
|
|
|
headerTitle="COLLECTION"/>
|
2015-10-07 09:39:30 +02:00
|
|
|
<ProxyRoute
|
|
|
|
path="signup"
|
|
|
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
|
|
|
component={SignupContainer} />
|
|
|
|
<ProxyRoute
|
|
|
|
path="logout"
|
|
|
|
proxyHandler={RedirectProxyHandler({to: '/', when: 'loggedOut'})}
|
|
|
|
component={LogoutContainer}/>
|
2015-09-30 17:09:46 +02:00
|
|
|
<Route path="pieces/:pieceId" component={PieceContainer} />
|
|
|
|
<Route path="editions/:editionId" component={EditionContainer} />
|
2015-10-07 09:39:30 +02:00
|
|
|
<ProxyRoute
|
|
|
|
path="password_reset"
|
|
|
|
proxyHandler={RedirectProxyHandler({to: '/collection', when: 'loggedIn'})}
|
|
|
|
component={PasswordResetContainer} />
|
|
|
|
<ProxyRoute
|
|
|
|
path="settings"
|
|
|
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
|
|
|
component={SettingsContainer}/>
|
|
|
|
<ProxyRoute
|
|
|
|
path="contract_settings"
|
|
|
|
proxyHandler={RedirectProxyHandler({to: '/login', when: 'loggedOut'})}
|
|
|
|
component={ContractSettings}/>
|
2015-09-30 18:30:50 +02:00
|
|
|
<Route path="coa_verify" component={CoaVerifyContainer} />
|
2015-09-30 17:09:46 +02:00
|
|
|
<Route path="*" component={ErrorNotFoundPage} />
|
2015-05-18 18:00:12 +02:00
|
|
|
</Route>
|
2015-05-18 13:43:42 +02:00
|
|
|
);
|
|
|
|
|
2015-07-10 16:43:35 +02:00
|
|
|
|
2015-08-11 17:40:26 +02:00
|
|
|
function getRoutes(type, subdomain) {
|
2015-07-10 16:43:35 +02:00
|
|
|
let routes = null;
|
2015-07-14 17:41:57 +02:00
|
|
|
|
2015-07-10 16:43:35 +02:00
|
|
|
if (type === 'prize') {
|
2015-08-11 17:40:26 +02:00
|
|
|
routes = getPrizeRoutes(COMMON_ROUTES, subdomain);
|
2015-08-11 14:47:28 +02:00
|
|
|
} else if(type === 'wallet') {
|
2015-08-11 17:40:26 +02:00
|
|
|
routes = getWalletRoutes(COMMON_ROUTES, subdomain);
|
2015-07-10 16:43:35 +02:00
|
|
|
} else {
|
2015-08-27 14:34:15 +02:00
|
|
|
routes = COMMON_ROUTES;
|
2015-07-10 16:43:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return routes;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default getRoutes;
|