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

24 lines
721 B
JavaScript
Raw Normal View History

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
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}/>
</Route>
);
}
const checkAuth = (store) => {
store.dispatch(getUser());
}
2016-05-18 19:37:59 +02:00
export default routes;