feat: refs #7925 wip redirect not found
This commit is contained in:
parent
f7de0f09de
commit
c64f87533d
|
@ -262,15 +262,14 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
const { path } = matches.at(-1);
|
||||
const rowsNumber = store.data.length;
|
||||
|
||||
if (path.includes(':id') && !rowsNumber)
|
||||
return router.push({
|
||||
name: 'NotFound',
|
||||
});
|
||||
|
||||
const to =
|
||||
rowsNumber === 1
|
||||
? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`)
|
||||
: path.replace(/:id.*/, '');
|
||||
let to;
|
||||
if (path.includes(':id') && !rowsNumber) {
|
||||
return router.push({ name: 'NotFound' });
|
||||
} else if (rowsNumber === 1) {
|
||||
to = path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`);
|
||||
} else {
|
||||
to = path.replace(/:id.*/, '');
|
||||
}
|
||||
|
||||
if (route.path != to) {
|
||||
const pushUrl = { path: to };
|
||||
|
|
Loading…
Reference in New Issue