p5.js-web-editor/client/routes.js

24 lines
721 B
JavaScript
Raw Normal View History

2016-05-18 17:37:59 +00:00
import { Route, IndexRoute } from 'react-router'
import React from 'react'
2016-06-22 17:49:06 +00:00
import App from './modules/App/App'
import IDEView from './modules/IDE/pages/IDEView'
2016-06-22 19:58:23 +00:00
import LoginView from './modules/User/pages/LoginView'
import SignupView from './modules/User/pages/SignupView'
import { getUser } from './modules/User/actions'
2016-05-18 17:37:59 +00: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 17:29:32 +00:00
<Route path="/projects/:project_id" component={IDEView}/>
</Route>
);
}
const checkAuth = (store) => {
store.dispatch(getUser());
}
2016-05-18 17:37:59 +00:00
export default routes;