mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
Bugfix: Broke functionality in previous commit
This commit is contained in:
parent
7901d7666e
commit
24ffef5d69
1 changed files with 13 additions and 10 deletions
|
@ -199,19 +199,22 @@ const router = createRouter({
|
||||||
});
|
});
|
||||||
|
|
||||||
router.beforeEach((to, from) => {
|
router.beforeEach((to, from) => {
|
||||||
// If the path is same, either the query or has has changed so avoid changing query params
|
|
||||||
// Without this check, modifying any query params will be blocked
|
|
||||||
// Check if redirectedFrom is defined to check if this function has already been run
|
// Check if redirectedFrom is defined to check if this function has already been run
|
||||||
// Without this check, the router will be stuck in an infinite loop
|
// Without this check, the router will be stuck in an infinite loop
|
||||||
if (to.fullPath !== from.fullPath && !to.redirectedFrom) {
|
if (to.redirectedFrom) return;
|
||||||
return {
|
|
||||||
...to,
|
// If the user is navigating to same page but to.query is empty, they have clicked on the same link
|
||||||
query: {
|
// For example: Clicked on Add monitor twice
|
||||||
...to.query,
|
if (to.path === from.path && Object.keys(to.query).length !== 0) {
|
||||||
...from.query,
|
return;
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
|
...to,
|
||||||
|
query: {
|
||||||
|
...to.query,
|
||||||
|
...from.query,
|
||||||
|
},
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export { router };
|
export { router };
|
||||||
|
|
Loading…
Reference in a new issue