diff options
Diffstat (limited to 'src/routes/index.js')
| -rw-r--r-- | src/routes/index.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/routes/index.js b/src/routes/index.js index deaf8ded..8a155cb0 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -2,6 +2,7 @@ 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"; @@ -10,6 +11,8 @@ import Simulations from "../pages/Simulations"; const ProtectedComponent = (component) => () => userIsLoggedIn() ? component : <Redirect to="/"/>; const AppComponent = ({match}) => userIsLoggedIn() ? <App simulationId={parseInt(match.params.id, 10)}/> : <Redirect to="/"/>; +const ExperimentsComponent = ({match}) => userIsLoggedIn() ? + <Experiments simulationId={parseInt(match.params.id, 10)}/> : <Redirect to="/"/>; const Routes = () => ( <BrowserRouter> @@ -17,6 +20,7 @@ const Routes = () => ( <Route exact path="/" component={Home}/> <Route exact path="/simulations" render={ProtectedComponent(<Simulations/>)}/> <Route exact path="/simulations/:id" component={AppComponent}/> + <Route exact path="/simulations/:id/experiments" component={ExperimentsComponent}/> <Route exact path="/profile" render={ProtectedComponent(<Profile/>)}/> <Route path="/*" component={NotFound}/> </Switch> |
