feat: refs #7925 redirect to not found
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-11-06 12:51:06 +01:00
parent 473b0808e8
commit 17dba2ac99
1 changed files with 7 additions and 1 deletions

View File

@ -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.*/, '');