1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00
onion/js/routes.js

69 lines
2.6 KiB
JavaScript
Raw Normal View History

'use strict';
import React from 'react';
2015-05-18 09:56:16 +02:00
import Router from 'react-router';
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 SettingsContainer from './components/ascribe_settings/settings_container';
2015-06-25 14:39:39 +02:00
import CoaVerifyContainer from './components/coa_verify_container';
2015-06-17 17:48:52 +02:00
import RegisterPiece from './components/register_piece';
2015-06-09 17:53:44 +02:00
import PrizesDashboard from './components/ascribe_prizes_dashboard/prizes_dashboard';
import AppConstants from './constants/application_constants';
2015-05-19 17:16:01 +02:00
let Route = Router.Route;
let Redirect = Router.Redirect;
let baseUrl = AppConstants.baseUrl;
2015-05-18 09:56:16 +02:00
const COMMON_ROUTES = (
<Route name="app" path={baseUrl} handler={App}>
<Redirect from={baseUrl} to="login" />
<Redirect from={baseUrl + '/'} to="login" />
2015-06-20 16:43:18 +02:00
<Route name="signup" path="signup" handler={SignupContainer} />
<Route name="login" path="login" handler={LoginContainer} />
2015-07-17 15:02:44 +02:00
<Route name="logout" path="logout" handler={LogoutContainer} />
<Route name="register_piece" path="register_piece" handler={RegisterPiece} headerTitle="+ NEW WORK" />
<Route name="pieces" path="collection" handler={PieceList} headerTitle="COLLECTION" />
2015-07-08 22:54:07 +02:00
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
2015-06-09 16:10:25 +02:00
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
2015-06-15 16:56:17 +02:00
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
2015-06-17 17:48:23 +02:00
<Route name="settings" path="settings" handler={SettingsContainer} />
2015-06-25 14:39:39 +02:00
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
<Route name="prizes" path="prizes" handler={PrizesDashboard} />
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;