From ff1e85c417988b196b87eccd982d04b2d2714d5b Mon Sep 17 00:00:00 2001 From: Morteza Karimi <2769101+karimi@users.noreply.github.com> Date: Sun, 2 Jun 2024 17:13:03 -0700 Subject: [PATCH] Only preserve version query (#130) --- quasar_site/src/router/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/quasar_site/src/router/index.js b/quasar_site/src/router/index.js index 95048d49..b9e751df 100644 --- a/quasar_site/src/router/index.js +++ b/quasar_site/src/router/index.js @@ -26,13 +26,17 @@ export default route(function (/* { store, ssrContext } */) { history: createHistory(process.env.VUE_ROUTER_BASE) }) - function hasQueryParams(route) { - return !!Object.keys(route.query).length; + function hasVersionParams(route) { + return Object.keys(route.query).includes("version"); } Router.beforeEach((to, from, next) => { - if (!hasQueryParams(to) && hasQueryParams(from)) { - next({ path: to.path, query: from.query, hash: to.hash }); + if (!hasVersionParams(to) && hasVersionParams(from)) { + next({ + path: to.path, + query: { ...to.query, version: from.query["version"] }, + hash: to.hash, + }); } else { next(); }