2016-05-18 19:37:59 +02:00
|
|
|
import { Route, IndexRoute } from 'react-router'
|
|
|
|
import React from 'react'
|
2016-06-22 19:49:06 +02:00
|
|
|
import App from './modules/App/App'
|
|
|
|
import IDEView from './modules/IDE/pages/IDEView'
|
2016-06-22 21:58:23 +02:00
|
|
|
import LoginView from './modules/User/pages/LoginView'
|
|
|
|
import SignupView from './modules/User/pages/SignupView'
|
|
|
|
import { getUser } from './modules/User/actions'
|
2016-05-18 19:37:59 +02:00
|
|
|
|
2016-06-15 01:11:42 +02:00
|
|
|
const routes = (store) => {
|
|
|
|
return (
|
|
|
|
<Route path="/" component={App}>
|
|
|
|
<IndexRoute component={IDEView} onEnter={checkAuth(store)}/>
|
|
|
|
<Route path="/login" component={LoginView}/>
|
|
|
|
<Route path="/signup" component={SignupView}/>
|
2016-06-20 19:29:32 +02:00
|
|
|
<Route path="/projects/:project_id" component={IDEView}/>
|
2016-06-15 01:11:42 +02:00
|
|
|
</Route>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const checkAuth = (store) => {
|
|
|
|
store.dispatch(getUser());
|
|
|
|
}
|
2016-05-18 19:37:59 +02:00
|
|
|
|
|
|
|
export default routes;
|