summaryrefslogtreecommitdiff
path: root/src/routes
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-08-21 12:08:41 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-23 10:05:43 +0200
commit1b6545fa653df44b019f6676faed39880999b2bf (patch)
treecb131975db09cdb401b082700e2075d462495897 /src/routes
parent8a49e1eedebb6d4c47edf6fd1a7545ea502d59e7 (diff)
Add basic react-konva rendering prototype
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/index.js4
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>