forked from verdnatura/salix-front
refs #6384 fix: redirect to same path when id change
This commit is contained in:
parent
94e4bb383a
commit
8861ee038d
|
@ -72,15 +72,10 @@ async function search() {
|
||||||
});
|
});
|
||||||
if (!props.redirect) return;
|
if (!props.redirect) return;
|
||||||
|
|
||||||
const rows = store.data;
|
const { matched: matches } = route;
|
||||||
const module = route.matched[1];
|
const { path } = matches[matches.length-1];
|
||||||
if (rows.length === 1) {
|
const newRoute = path.replace(':id', searchText.value);
|
||||||
const [firstRow] = rows;
|
await router.push(newRoute);
|
||||||
await router.push({ path: `${module.path}/${firstRow.id}` });
|
|
||||||
} else if (route.matched.length > 3) {
|
|
||||||
await router.push({ path: `/${module.path}` });
|
|
||||||
arrayData.updateStateParams();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue