diff --git a/src/composables/useRedirect.js b/src/composables/useRedirect.js index 94ca5d0cb..0666a245f 100644 --- a/src/composables/useRedirect.js +++ b/src/composables/useRedirect.js @@ -13,12 +13,11 @@ export default function useRedirect() { const { matched: matches } = router.currentRoute.value; const { path } = matches.at(-1); - if (data.length === 1) - return router.push({ - path: path.replace(/\/(list|-list|:id)/, `/${data[0].id}`), - }); + let to = path.replace(/:id.*/, ''); - router.push({ path: path.replace(/:id.*/, '') }); + if (data.length === 1) to = path.replace(/\/(list|-list|:id)/, `/${data[0].id}`); + + router.push({ path: to }); }; return { navigate };