feat: refs #7925 wip redirect not found

This commit is contained in:
Jorge Penadés 2024-11-07 14:34:33 +01:00
parent f7de0f09de
commit c64f87533d
1 changed files with 8 additions and 9 deletions

View File

@ -262,15 +262,14 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
const { path } = matches.at(-1); const { path } = matches.at(-1);
const rowsNumber = store.data.length; const rowsNumber = store.data.length;
if (path.includes(':id') && !rowsNumber) let to;
return router.push({ if (path.includes(':id') && !rowsNumber) {
name: 'NotFound', return router.push({ name: 'NotFound' });
}); } else if (rowsNumber === 1) {
to = path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`);
const to = } else {
rowsNumber === 1 to = path.replace(/:id.*/, '');
? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`) }
: path.replace(/:id.*/, '');
if (route.path != to) { if (route.path != to) {
const pushUrl = { path: to }; const pushUrl = { path: to };