From 70b015b64cf66d59e0c0adf9d3c8145c4266defc Mon Sep 17 00:00:00 2001 From: Simon Hamery Date: Mon, 9 Dec 2024 15:49:04 +0100 Subject: [PATCH] fix: fetch la simulation en cas de redirection (#4755) --- src/router.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/router.ts b/src/router.ts index c1e10ca83f..af1d9b2f8b 100644 --- a/src/router.ts +++ b/src/router.ts @@ -45,7 +45,15 @@ const router = createRouter({ beforeEnter(to, from, next) { const simulationLatestId = Simulations.getLatestId() if (simulationLatestId) { - next(`/simulation${to.query.to || ""}`) + const store = useStore() + store + .fetch(simulationLatestId) + .then(() => { + next(`/simulation${to.query.to || ""}`) + }) + .catch(() => { + next("/") + }) } else { next("/") }