summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/routes
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-25 14:53:54 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-25 14:53:54 +0200
commitaa9b32f8cd1467e9718959f400f6777e5d71737d (patch)
treeb88bbede15108c6855d7f94ded4c7054df186a72 /opendc-web/opendc-web-ui/src/routes
parenteb0e0a3bc557c05a70eead388797ab850ea87366 (diff)
parentb7a71e5b4aa77b41ef41deec2ace42b67a5a13a7 (diff)
merge: Integrate v2.1 progress into public repository
This pull request integrates the changes planned for the v2.1 release of OpenDC into the public Github repository in order to sync the progress of both repositories.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/routes')
-rw-r--r--opendc-web/opendc-web-ui/src/routes/index.js40
1 files changed, 0 insertions, 40 deletions
diff --git a/opendc-web/opendc-web-ui/src/routes/index.js b/opendc-web/opendc-web-ui/src/routes/index.js
deleted file mode 100644
index 4291a046..00000000
--- a/opendc-web/opendc-web-ui/src/routes/index.js
+++ /dev/null
@@ -1,40 +0,0 @@
-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 Projects from '../pages/Projects'
-
-const ProtectedComponent = (component) => () => (userIsLoggedIn() ? component : <Redirect to="/" />)
-const AppComponent = ({ match }) =>
- userIsLoggedIn() ? (
- <App
- projectId={match.params.projectId}
- portfolioId={match.params.portfolioId}
- scenarioId={match.params.scenarioId}
- />
- ) : (
- <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} />
- </Switch>
- </BrowserRouter>
-)
-
-export default Routes