From 968f61239b97b57006434d8914909dd740a29dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Thu, 2 Mar 2023 15:33:04 +0100 Subject: [PATCH] Fix iframe --- site/source/pages/Iframes/index.tsx | 4 ++-- site/source/pages/Simulateurs/Home.tsx | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/site/source/pages/Iframes/index.tsx b/site/source/pages/Iframes/index.tsx index ed5608a46..81fc38f70 100644 --- a/site/source/pages/Iframes/index.tsx +++ b/site/source/pages/Iframes/index.tsx @@ -1,5 +1,5 @@ import { Helmet } from 'react-helmet-async' -import { Route, Routes } from 'react-router-dom' +import { Route, Routes, useLocation } from 'react-router-dom' import Route404 from '@/components/Route404' import useSimulatorsData from '@/hooks/useSimulatorsData' @@ -26,7 +26,7 @@ export default function Iframes() { s.iframePath && ( diff --git a/site/source/pages/Simulateurs/Home.tsx b/site/source/pages/Simulateurs/Home.tsx index 876479d1f..494ff1da7 100644 --- a/site/source/pages/Simulateurs/Home.tsx +++ b/site/source/pages/Simulateurs/Home.tsx @@ -279,7 +279,10 @@ export function SimulateurCard({ 'Lancer le simulateur' ) } - to={{ pathname: (isIframe && iframePath) || path }} + to={{ + pathname: + (isIframe && `/iframes/${encodeURI(iframePath ?? '')}`) || path, + }} state={fromGérer ? { fromGérer: true } : { fromSimulateurs: true }} role="link" >