Skip to content

Commit

Permalink
fix: fetch la simulation en cas de redirection (#4755)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shamzic authored Dec 9, 2024
1 parent c58be03 commit 70b015b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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("/")
}
Expand Down

0 comments on commit 70b015b

Please sign in to comment.