WIP: #7925 remove redirect #897

Draft
jorgep wants to merge 4 commits from 7925-removeRedirect into dev
1 changed files with 7 additions and 1 deletions
Showing only changes of commit 17dba2ac99 - Show all commits

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