diff options
Diffstat (limited to 'opendc-web/opendc-web-ui/src/data/project.js')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/data/project.js | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/opendc-web/opendc-web-ui/src/data/project.js b/opendc-web/opendc-web-ui/src/data/project.js index d4c95370..30b36efa 100644 --- a/opendc-web/opendc-web-ui/src/data/project.js +++ b/opendc-web/opendc-web-ui/src/data/project.js @@ -21,6 +21,7 @@ */ import { useSelector } from 'react-redux' +import { useRouter } from 'next/router' /** * Return the available projects. @@ -40,23 +41,9 @@ export function useProject(projectId) { * Return the current active project. */ export function useActiveProject() { - return useSelector((state) => - state.currentProjectId !== '-1' ? state.objects.project[state.currentProjectId] : undefined - ) -} - -/** - * Return the active portfolio. - */ -export function useActivePortfolio() { - return useSelector((state) => state.objects.portfolio[state.currentPortfolioId]) -} - -/** - * Return the active scenario. - */ -export function useActiveScenario() { - return useSelector((state) => state.objects.scenario[state.currentScenarioId]) + const router = useRouter() + const { project: projectId } = router.query + return useSelector((state) => state.objects.project[projectId]) } /** |
