1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +01:00

Restore baseUrl in router

This commit is contained in:
vrde 2015-10-13 14:19:08 +02:00
parent dc97517d65
commit 7c231a4c5e
4 changed files with 14 additions and 12 deletions

View File

@ -17,16 +17,13 @@ import CoaVerifyContainer from '../../../components/coa_verify_container';
import ErrorNotFoundPage from '../../../components/error_not_found_page'; import ErrorNotFoundPage from '../../../components/error_not_found_page';
import App from './prize_app'; import App from './prize_app';
import AppConstants from '../../../constants/application_constants';
import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler'; import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler';
let baseUrl = AppConstants.baseUrl;
function getRoutes() { function getRoutes() {
return ( return (
<Route path={baseUrl} component={App}> <Route path='/' component={App}>
<IndexRoute component={Landing} /> <IndexRoute component={Landing} />
<Route <Route
path='login' path='login'

View File

@ -33,14 +33,11 @@ import CCRegisterPiece from './components/cc/cc_register_piece';
import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler'; import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler';
import WalletApp from './wallet_app'; import WalletApp from './wallet_app';
import AppConstants from '../../../constants/application_constants';
let baseUrl = AppConstants.baseUrl;
let ROUTES = { let ROUTES = {
'cyland': ( 'cyland': (
<Route path={baseUrl} component={WalletApp}> <Route path='/' component={WalletApp}>
<IndexRoute component={CylandLanding} /> <IndexRoute component={CylandLanding} />
<Route <Route
path='login' path='login'
@ -75,7 +72,7 @@ let ROUTES = {
</Route> </Route>
), ),
'cc': ( 'cc': (
<Route path={baseUrl} component={WalletApp}> <Route path='/' component={WalletApp}>
<Route <Route
path='login' path='login'
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} /> component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />
@ -109,7 +106,7 @@ let ROUTES = {
</Route> </Route>
), ),
'ikonotv': ( 'ikonotv': (
<Route path={baseUrl} component={WalletApp}> <Route path='/' component={WalletApp}>
<IndexRoute component={IkonotvLanding} /> <IndexRoute component={IkonotvLanding} />
<Route <Route
path='login' path='login'

View File

@ -1,5 +1,13 @@
'use strict'; 'use strict';
import useBasename from 'history/lib/useBasename';
import createBrowserHistory from 'history/lib/createBrowserHistory'; import createBrowserHistory from 'history/lib/createBrowserHistory';
import AppConstants from './constants/application_constants';
export default createBrowserHistory();
// Remove the trailing slash if present
let baseUrl = AppConstants.baseUrl.replace(/\/$/, '');
export default useBasename(createBrowserHistory)({
basename: baseUrl
});

View File

@ -33,7 +33,7 @@ import AppConstants from './constants/application_constants';
let baseUrl = AppConstants.baseUrl; let baseUrl = AppConstants.baseUrl;
let COMMON_ROUTES = ( let COMMON_ROUTES = (
<Route path={baseUrl} component={App}> <Route path='/' component={App}>
<Route <Route
path="login" path="login"
component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} /> component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(LoginContainer)} />