2015-07-10 16:43:35 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
2015-10-09 15:19:24 +02:00
|
|
|
import { Route, IndexRoute } from 'react-router';
|
2015-07-10 16:43:35 +02:00
|
|
|
|
2015-11-05 16:45:12 +01:00
|
|
|
import SPLanding from './simple_prize/components/prize_landing';
|
|
|
|
import SPLoginContainer from './simple_prize/components/prize_login_container';
|
|
|
|
import SPSignupContainer from './simple_prize/components/prize_signup_container';
|
|
|
|
import SPRegisterPiece from './simple_prize/components/prize_register_piece';
|
|
|
|
import SPPieceList from './simple_prize/components/prize_piece_list';
|
|
|
|
import SPPieceContainer from './simple_prize/components/ascribe_detail/prize_piece_container';
|
|
|
|
import SPSettingsContainer from './simple_prize/components/prize_settings_container';
|
|
|
|
import SPApp from './simple_prize/prize_app';
|
2015-07-10 16:43:35 +02:00
|
|
|
|
2015-11-06 12:09:31 +01:00
|
|
|
import PRApp from './portfolioreview/pr_app';
|
|
|
|
import PRLanding from './portfolioreview/components/pr_landing';
|
|
|
|
|
2015-11-05 16:45:12 +01:00
|
|
|
import EditionContainer from '../../ascribe_detail/edition_container';
|
|
|
|
import LogoutContainer from '../../logout_container';
|
|
|
|
import PasswordResetContainer from '../../password_reset_container';
|
|
|
|
import CoaVerifyContainer from '../../coa_verify_container';
|
|
|
|
import ErrorNotFoundPage from '../../error_not_found_page';
|
2015-07-10 16:43:35 +02:00
|
|
|
|
2015-10-12 17:00:53 +02:00
|
|
|
import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler';
|
2015-10-09 15:19:24 +02:00
|
|
|
|
2015-07-10 16:43:35 +02:00
|
|
|
|
2015-11-05 16:45:12 +01:00
|
|
|
const ROUTES = {
|
2015-11-06 12:09:31 +01:00
|
|
|
sluice: (
|
2015-11-05 16:45:12 +01:00
|
|
|
<Route path='/' component={SPApp}>
|
|
|
|
<IndexRoute component={SPLanding} />
|
2015-10-12 16:51:03 +02:00
|
|
|
<Route
|
|
|
|
path='login'
|
2015-11-05 16:45:12 +01:00
|
|
|
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SPLoginContainer)} />
|
2015-10-12 16:51:03 +02:00
|
|
|
<Route
|
|
|
|
path='logout'
|
2015-10-12 17:00:53 +02:00
|
|
|
component={AuthProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
2015-10-12 16:51:03 +02:00
|
|
|
<Route
|
|
|
|
path='signup'
|
2015-11-05 16:45:12 +01:00
|
|
|
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SPSignupContainer)} />
|
2015-10-12 16:51:03 +02:00
|
|
|
<Route
|
|
|
|
path='password_reset'
|
2015-10-12 17:00:53 +02:00
|
|
|
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
2015-10-12 16:51:03 +02:00
|
|
|
<Route
|
|
|
|
path='settings'
|
2015-11-05 16:45:12 +01:00
|
|
|
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(SPSettingsContainer)}/>
|
2015-10-12 16:51:03 +02:00
|
|
|
<Route
|
|
|
|
path='register_piece'
|
2015-11-05 16:45:12 +01:00
|
|
|
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(SPRegisterPiece)}
|
2015-10-12 16:51:03 +02:00
|
|
|
headerTitle='+ NEW WORK'/>
|
|
|
|
<Route
|
|
|
|
path='collection'
|
2015-11-05 16:45:12 +01:00
|
|
|
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(SPPieceList)}
|
2015-10-12 16:51:03 +02:00
|
|
|
headerTitle='COLLECTION'/>
|
2015-10-09 15:19:24 +02:00
|
|
|
|
2015-11-05 16:45:12 +01:00
|
|
|
<Route path='pieces/:pieceId' component={SPPieceContainer} />
|
2015-10-12 16:51:03 +02:00
|
|
|
<Route path='editions/:editionId' component={EditionContainer} />
|
|
|
|
<Route path='verify' component={CoaVerifyContainer} />
|
|
|
|
<Route path='*' component={ErrorNotFoundPage} />
|
2015-07-10 16:43:35 +02:00
|
|
|
</Route>
|
2015-11-06 12:09:31 +01:00
|
|
|
),
|
|
|
|
portfolioreview: (
|
|
|
|
<Route path='/' component={PRApp}>
|
|
|
|
<IndexRoute component={PRLanding} />
|
|
|
|
<Route
|
|
|
|
path='register_piece'
|
|
|
|
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(SPRegisterPiece)}
|
|
|
|
headerTitle='+ NEW WORK'/>
|
|
|
|
<Route
|
|
|
|
path='login'
|
|
|
|
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SPLoginContainer)} />
|
|
|
|
<Route
|
|
|
|
path='logout'
|
|
|
|
component={AuthProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/>
|
|
|
|
<Route
|
|
|
|
path='signup'
|
|
|
|
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SPSignupContainer)} />
|
|
|
|
<Route
|
|
|
|
path='password_reset'
|
|
|
|
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} />
|
|
|
|
<Route path='*' component={ErrorNotFoundPage} />
|
|
|
|
</Route>
|
2015-11-05 16:45:12 +01:00
|
|
|
)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function getRoutes(commonRoutes, subdomain) {
|
|
|
|
if(subdomain in ROUTES) {
|
|
|
|
return ROUTES[subdomain];
|
|
|
|
} else {
|
|
|
|
throw new Error('Subdomain wasn\'t specified in the wallet app.');
|
|
|
|
}
|
2015-07-10 16:43:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-12 16:51:03 +02:00
|
|
|
export default getRoutes;
|