MyCrypto/common/routing/index.jsx

29 lines
922 B
React
Raw Normal View History

2017-04-12 05:04:27 +00:00
import React from 'react';
import {Route, Redirect, browserHistory, IndexRoute} from 'react-router';
import {useBasename} from 'history'
import {App, Tabs} from 'containers';
2017-04-12 05:04:27 +00:00
export const history = getHistory()
/**
* Returns application routing with protected by AuthCheck func routes
* @param {Function} AuthCheck checks is user logged in
*/
export const Routing = (AuthCheck) => (
<Route name="App" path='' component={App}>
{/*<IndexRoute name="Login" component={Login}/>*/}
{/*<Route name="Login" path="/auth" component={Login}/>*/}
{/*<Route name="Inbox" path="/inbox" component={Inbox}/>*/}
<Route name="Tabs" path="/" component={Tabs}/>
2017-04-12 05:04:27 +00:00
<Redirect from="/*" to="/"/>
</Route>
)
function getHistory() {
const basename = process.env.BUILD_GH_PAGES
? '/react-semantic.ui-starter'
: ''
return useBasename(() => browserHistory)({basename})
}