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