summaryrefslogtreecommitdiff
path: root/frontend/src/routes/index.js
diff options
context:
space:
mode:
authorjc0b <j@jc0b.computer>2020-07-22 16:28:47 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:48:21 +0200
commitd7469b9ebb01cf36a78cc98aab31fa8f307c4f65 (patch)
treed0535fa0cfe95001302fbd2b0d046d51caab6ffd /frontend/src/routes/index.js
parent67b6ec800df8e023efadb60ae5f7919030b19789 (diff)
parent9e7cb3bd367607b32e102c3a87b68b33c53dec46 (diff)
Merge branch 'master' onto working copy
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>
)