WIP: #7925 remove redirect #897

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

View File

@ -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 };