0
0
Fork 0

refs #6384 fix: redirect to same path when id change

This commit is contained in:
Javier Segarra 2024-01-09 10:35:39 +01:00
parent 94e4bb383a
commit 8861ee038d
1 changed files with 4 additions and 9 deletions

View File

@ -72,15 +72,10 @@ async function search() {
});
if (!props.redirect) return;
const rows = store.data;
const module = route.matched[1];
if (rows.length === 1) {
const [firstRow] = rows;
await router.push({ path: `${module.path}/${firstRow.id}` });
} else if (route.matched.length > 3) {
await router.push({ path: `/${module.path}` });
arrayData.updateStateParams();
}
const { matched: matches } = route;
const { path } = matches[matches.length-1];
const newRoute = path.replace(':id', searchText.value);
await router.push(newRoute);
}
</script>