0π
β
Itβs not great, but I modified hackSearch()
so it would return whether or not it had found an offending term and replaced it. This enables the code above to be modified as follows:
{
name: "search",
path: "/search",
component: Records,
beforeEnter(to, from, next) {
let [query, modified] = hackSearch(to.query);
if (modified) {
next({name: 'search', query: query});
}
else {
next();
}
}
},
Source:stackexchange.com