|
|
|
import React from 'react';
|
|
|
|
import Router, {Route} from 'react-router';
|
|
|
|
import AuthenticatedApp from './components/AuthenticatedApp'
|
|
|
|
import Login from './components/Login';
|
|
|
|
import Signup from './components/Signup';
|
|
|
|
import Home from './components/Home';
|
|
|
|
import Quote from './components/Quote';
|
|
|
|
import Account from './components/Account';
|
|
|
|
import Tx from './components/Tx';
|
|
|
|
import RouterContainer from './services/RouterContainer';
|
|
|
|
import LoginActions from './actions/LoginActions';
|
|
|
|
|
|
|
|
var routes = (
|
|
|
|
<Route handler={AuthenticatedApp}>
|
|
|
|
<Route name="login" handler={Login}/>
|
|
|
|
<Route name="signup" handler={Signup}/>
|
|
|
|
<Route name="home" path="/" handler={Home}/>
|
|
|
|
<Route name="quote" handler={Quote}/>
|
|
|
|
<Route name="account" handler={Account}>
|
|
|
|
<Route path="txs/:accountId" handler={Tx}/>
|
|
|
|
</Route>
|
|
|
|
</Route>
|
|
|
|
);
|
|
|
|
|
|
|
|
var router = Router.create({routes});
|
|
|
|
RouterContainer.set(router);
|
|
|
|
|
|
|
|
let jwt = localStorage.getItem('jwt');
|
|
|
|
if (jwt) {
|
|
|
|
LoginActions.loginUser(jwt);
|
|
|
|
}
|
|
|
|
|
|
|
|
router.run(function (Handler) {
|
|
|
|
React.render(<Handler />, document.getElementById('content'));
|
|
|
|
});
|