Upstream sync
This commit is contained in:
@@ -8,6 +8,10 @@ import { Router, hashHistory, browserHistory } from 'react-router';
|
||||
import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux';
|
||||
import reducers from './reducers';
|
||||
import Instance from './components/Connection';
|
||||
import {
|
||||
loggedUser,
|
||||
visitReporter,
|
||||
} from 'utils/authorization';
|
||||
|
||||
const middleware = routerMiddleware(hashHistory);
|
||||
const store = createStore(
|
||||
@@ -55,7 +59,15 @@ const rootRoute = {
|
||||
onChange: requireAuth,
|
||||
onEnter: requireAuth,
|
||||
component: require('./containers/App'),
|
||||
indexRoute: { onEnter: (nextState, replace) => replace('/app/table/rides') },
|
||||
indexRoute: {
|
||||
onEnter: (nextState, replace) => {
|
||||
if (loggedUser.anyOf(visitReporter)) {
|
||||
replace('/app/form/visit/' + loggedUser.useruuid)
|
||||
} else {
|
||||
replace('/app/table/rides');
|
||||
}
|
||||
}
|
||||
},
|
||||
childRoutes: [
|
||||
require('./routes/app'),
|
||||
require('./routes/404'),
|
||||
|
||||
Reference in New Issue
Block a user