summaryrefslogtreecommitdiff
path: root/frontend/src/routes/index.js
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-07-22 14:07:39 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:48:18 +0200
commit92ce9387f5c3ce54b4077ef6a5f604fc2cfe6ade (patch)
tree90432dbd06a13d300f8307dea342f4639c9c57e7 /frontend/src/routes/index.js
parentae8f03d514ba0982a34b96f1e29e262ca6048a19 (diff)
parent8739a156b75ba96e15d1bb19b08ca829c1eb01e8 (diff)
Merge pull request #12 from atlarge-research/feature/scenario-plots
Plotting of portfolio results
Diffstat (limited to 'frontend/src/routes/index.js')
-rw-r--r--frontend/src/routes/index.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/frontend/src/routes/index.js b/frontend/src/routes/index.js
index 96f615b1..4291a046 100644
--- a/frontend/src/routes/index.js
+++ b/frontend/src/routes/index.js
@@ -7,7 +7,7 @@ import NotFound from '../pages/NotFound'
import Profile from '../pages/Profile'
import Projects from '../pages/Projects'
-const ProtectedComponent = (component) => () => (userIsLoggedIn() ? component : <Redirect to="/"/>)
+const ProtectedComponent = (component) => () => (userIsLoggedIn() ? component : <Redirect to="/" />)
const AppComponent = ({ match }) =>
userIsLoggedIn() ? (
<App
@@ -15,18 +15,24 @@ const AppComponent = ({ match }) =>
portfolioId={match.params.portfolioId}
scenarioId={match.params.scenarioId}
/>
- ) : <Redirect to="/"/>
+ ) : (
+ <Redirect to="/" />
+ )
const Routes = () => (
<BrowserRouter>
<Switch>
- <Route exact path="/" component={Home}/>
- <Route exact path="/projects" render={ProtectedComponent(<Projects/>)}/>
- <Route exact path="/projects/:projectId" component={AppComponent}/>
- <Route exact path="/projects/:projectId/portfolios/:portfolioId" component={AppComponent}/>
- <Route exact path="/projects/:projectId/portfolios/:portfolioId/scenarios/:scenarioId" component={AppComponent}/>
- <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="/projects/:projectId/portfolios/:portfolioId" component={AppComponent} />
+ <Route
+ exact
+ path="/projects/:projectId/portfolios/:portfolioId/scenarios/:scenarioId"
+ component={AppComponent}
+ />
+ <Route exact path="/profile" render={ProtectedComponent(<Profile />)} />
+ <Route path="/*" component={NotFound} />
</Switch>
</BrowserRouter>
)