summaryrefslogtreecommitdiff
path: root/frontend/src/routes
diff options
context:
space:
mode:
authorjc0b <j@jc0b.computer>2020-07-07 16:55:22 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:47:51 +0200
commit223e916997eb641a1662110b6de630a4cdfdf479 (patch)
tree90ca4364461f676db45f25e03d8f22fc32f9fdd8 /frontend/src/routes
parent9ff1e3c6bae253372a468dbdc9b8369ab8dd2c6f (diff)
parentb810c4413079bf5aeb5374f1cd20e151a83530d0 (diff)
Merge branch 'feature/mongodb-migration' of github.com:atlarge-research/opendc-dev into feature/mongodb-migration
Diffstat (limited to 'frontend/src/routes')
-rw-r--r--frontend/src/routes/index.js29
1 files changed, 8 insertions, 21 deletions
diff --git a/frontend/src/routes/index.js b/frontend/src/routes/index.js
index ea703567..d3f50be5 100644
--- a/frontend/src/routes/index.js
+++ b/frontend/src/routes/index.js
@@ -2,36 +2,23 @@ import React from 'react'
import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom'
import { userIsLoggedIn } from '../auth/index'
import App from '../pages/App'
-import Experiments from '../pages/Experiments'
import Home from '../pages/Home'
import NotFound from '../pages/NotFound'
import Profile from '../pages/Profile'
-import Simulations from '../pages/Simulations'
+import Projects from '../pages/Projects'
-const ProtectedComponent = (component) => () => (userIsLoggedIn() ? component : <Redirect to="/" />)
+const ProtectedComponent = (component) => () => (userIsLoggedIn() ? component : <Redirect to="/"/>)
const AppComponent = ({ match }) =>
- userIsLoggedIn() ? <App simulationId={match.params.simulationId} /> : <Redirect to="/" />
-
-const ExperimentsComponent = ({ match }) =>
- userIsLoggedIn() ? <Experiments simulationId={match.params.simulationId} /> : <Redirect to="/" />
-
-const SimulationComponent = ({ match }) =>
- userIsLoggedIn() ? (
- <App simulationId={match.params.simulationId} inSimulation={true} experimentId={match.params.experimentId} />
- ) : (
- <Redirect to="/" />
- )
+ userIsLoggedIn() ? <App projectId={match.params.projectId}/> : <Redirect to="/"/>
const Routes = () => (
<BrowserRouter>
<Switch>
- <Route exact path="/" component={Home} />
- <Route exact path="/simulations" render={ProtectedComponent(<Simulations />)} />
- <Route exact path="/simulations/:simulationId" component={AppComponent} />
- <Route exact path="/simulations/:simulationId/experiments" component={ExperimentsComponent} />
- <Route exact path="/simulations/:simulationId/experiments/:experimentId" component={SimulationComponent} />
- <Route exact path="/profile" render={ProtectedComponent(<Profile />)} />
- <Route path="/*" component={NotFound} />
+ <Route exact path="/" component={Home}/>
+ <Route exact path="/projects" render={ProtectedComponent(<Projects/>)}/>
+ <Route exact path="/projects/:projectId" component={AppComponent}/>
+ <Route exact path="/profile" render={ProtectedComponent(<Profile/>)}/>
+ <Route path="/*" component={NotFound}/>
</Switch>
</BrowserRouter>
)