router icon indicating copy to clipboard operation
router copied to clipboard

fix(router): allow duplicated navigation on back + redirect

Open posva opened this issue 1 year ago • 2 comments

Fix #1850

I need to test this more as it could have other consequences. For the moment a workaround is to avoid the navigation duplication:

router.beforeEach((to, from) => {
  if (!localStorage.getItem("JWT") && to.name !== "Home") {
    console.log("intercepting, no token, URL should be: ", from.fullPath);
	if (from.name === 'Home') return false // avoid duplicated navigation
    return { name: "Home" };
  }
});

posva avatar Feb 06 '24 20:02 posva

Deploy Preview for vue-router canceled.

Name Link
Latest commit 6571e9ecf0b61c293de24db8261e9d100f308f53
Latest deploy log https://app.netlify.com/sites/vue-router/deploys/65c29b5f9ecbe20008f3c550

netlify[bot] avatar Feb 06 '24 20:02 netlify[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (2df32af) 90.85% compared to head (6571e9e) 91.27%. Report is 9 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2133      +/-   ##
==========================================
+ Coverage   90.85%   91.27%   +0.41%     
==========================================
  Files          24       24              
  Lines        1115     1180      +65     
  Branches      347      379      +32     
==========================================
+ Hits         1013     1077      +64     
- Misses         63       64       +1     
  Partials       39       39              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Feb 06 '24 20:02 codecov-commenter