diff options
Diffstat (limited to 'src/routes')
| -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 af1b70b5..deaf8ded 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -1,18 +1,22 @@ import React from 'react'; import {BrowserRouter, Redirect, Route, Switch} from "react-router-dom"; import {userIsLoggedIn} from "../auth/index"; +import App from "../pages/App"; import Home from "../pages/Home"; import NotFound from "../pages/NotFound"; import Profile from "../pages/Profile"; 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 Routes = () => ( <BrowserRouter> <Switch> <Route exact path="/" component={Home}/> <Route exact path="/simulations" render={ProtectedComponent(<Simulations/>)}/> + <Route exact path="/simulations/:id" component={AppComponent}/> <Route exact path="/profile" render={ProtectedComponent(<Profile/>)}/> <Route path="/*" component={NotFound}/> </Switch> |
