2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00

incr: remove details from the route info

This commit is contained in:
18alantom 2022-03-11 11:44:38 +05:30
parent f6219f956c
commit bbde25f392

View File

@ -116,8 +116,25 @@ const routes = [
let router = createRouter({ routes, history: createWebHistory() });
router.afterEach((to, from, failure) => {
const more = { from: from.fullPath, to: to.fullPath };
function removeDetails(path) {
if (!path) {
return path;
}
const match = path.match(/edit=1/);
if (!match) {
return path;
}
return path.slice(0, match.index + 4);
}
router.afterEach((to, from) => {
const more = {
from: removeDetails(from.fullPath),
to: removeDetails(to.fullPath),
};
telemetry.log(Verb.Navigated, NounEnum.Route, more);
});