diff options
Diffstat (limited to 'frontend/src/routes/index.js')
| -rw-r--r-- | frontend/src/routes/index.js | 24 |
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> ) |
