From 17dba2ac99b351337d714614c7dadc5fd525878c Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 6 Nov 2024 12:51:06 +0100 Subject: [PATCH] feat: refs #7925 redirect to not found --- src/composables/useArrayData.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index a2eaa649a..e5742f771 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -260,9 +260,15 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { }); const { matched: matches } = router.currentRoute.value; const { path } = matches.at(-1); + const rowsNumber = store.data.length; + + if (path.includes(':id') && !rowsNumber) + return router.push({ + name: 'NotFound', + }); const to = - store?.data?.length === 1 + rowsNumber === 1 ? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`) : path.replace(/:id.*/, '');