Skip to content
Snippets Groups Projects
Commit 7c7a09cc authored by Rémi PAILHAREY's avatar Rémi PAILHAREY :fork_knife_plate:
Browse files

fix(router): redirect to termsView when terms are not accepted

parent 0cb3d6cf
Branches
Tags
1 merge request!8382.3.0 Release
......@@ -44,61 +44,63 @@ const AppRoutes: React.FC<RouteProps> = ({ termsStatus }: RouteProps) => {
}
>
<Routes>
{termsStatus.accepted && (
<Route
path="/terms"
element={<Navigate replace to="/consumption" />}
/>
)}
<Route path="/terms" element={<TermsView />} />
{!termsStatus.accepted && (
<>
<Route path="/terms" element={<TermsView />} />
<Route path="*" element={<Navigate replace to="/terms" />} />
<Route path="/" element={<Navigate replace to="/terms" />} />
</>
)}
<Route
path="/consumption/electricity"
element={<ConsumptionView fluidType={FluidType.ELECTRICITY} />}
/>
<Route
path="/consumption/water"
element={<ConsumptionView fluidType={FluidType.WATER} />}
/>
<Route
path="/consumption/gas"
element={<ConsumptionView fluidType={FluidType.GAS} />}
/>
<Route
path="/consumption"
element={<ConsumptionView fluidType={FluidType.MULTIFLUID} />}
/>
<Route path="/sge-connect" element={<SgeConnectView />} />
<Route path="/challenges/duel" element={<DuelView />} />
<Route path="/challenges/quiz" element={<QuizView />} />
<Route path="/challenges/exploration" element={<ExplorationView />} />
<Route path="/challenges/action" element={<ActionView />} />
<Route path="/challenges/" element={<ChallengeView />} />
<Route path="/ecogesture-form" element={<EcogestureFormView />} />
<Route path="/ecogesture-selection" element={<EcogestureSelection />} />
<Route
path="/ecogesture/:ecogestureID/:tab"
element={<SingleEcogesture />}
/>
<Route
path="/ecogesture/:ecogestureID"
element={<SingleEcogesture />}
/>
<Route path="/ecogestures" element={<EcogestureView />} />
<Route path="/options/legalnotice" element={<LegalNoticeView />} />
<Route path="/options/gcu" element={<GCUView />} />
<Route path="/options/:connectParam" element={<OptionsView />} />
<Route path="/options" element={<OptionsView />} />
<Route path="/analysis" element={<AnalysisView />} />
<Route path="/profiletype" element={<ProfileTypeView />} />
<Route path="/unsubscribe" element={<UnSubscribe />} />
<Route path="/" element={<Navigate replace to="/consumption" />} />
<Route path="*" element={<Navigate replace to="/consumption" />} />
{termsStatus.accepted && (
<>
<Route
path="/consumption/electricity"
element={<ConsumptionView fluidType={FluidType.ELECTRICITY} />}
/>
<Route
path="/consumption/water"
element={<ConsumptionView fluidType={FluidType.WATER} />}
/>
<Route
path="/consumption/gas"
element={<ConsumptionView fluidType={FluidType.GAS} />}
/>
<Route
path="/consumption"
element={<ConsumptionView fluidType={FluidType.MULTIFLUID} />}
/>
<Route path="/sge-connect" element={<SgeConnectView />} />
<Route path="/challenges/duel" element={<DuelView />} />
<Route path="/challenges/quiz" element={<QuizView />} />
<Route
path="/challenges/exploration"
element={<ExplorationView />}
/>
<Route path="/challenges/action" element={<ActionView />} />
<Route path="/challenges/" element={<ChallengeView />} />
<Route path="/ecogesture-form" element={<EcogestureFormView />} />
<Route
path="/ecogesture-selection"
element={<EcogestureSelection />}
/>
<Route
path="/ecogesture/:ecogestureID/:tab"
element={<SingleEcogesture />}
/>
<Route
path="/ecogesture/:ecogestureID"
element={<SingleEcogesture />}
/>
<Route path="/ecogestures" element={<EcogestureView />} />
<Route path="/options/legalnotice" element={<LegalNoticeView />} />
<Route path="/options/gcu" element={<GCUView />} />
<Route path="/options/:connectParam" element={<OptionsView />} />
<Route path="/options" element={<OptionsView />} />
<Route path="/analysis" element={<AnalysisView />} />
<Route path="/profiletype" element={<ProfileTypeView />} />
<Route path="/unsubscribe" element={<UnSubscribe />} />
<Route path="*" element={<Navigate replace to="/consumption" />} />
</>
)}
</Routes>
</Suspense>
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment