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;
|
||||
|
||||
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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue