Handling duplicated routes in Vue.js
For one of my side projects, I’m using Vue.js[2] to develop a web client. Vue.js offers an official router for the framework called Vue Router[3].
In order to navigate between Views, the framework offers the following function:
router.push({ name: 'home'}) But what happens if we are already in the view home? We get the following nasty error:
NavigationDuplicated { _name: "NavigationDuplicated", name: "NavigationDuplicated", message: "Navigating to current location ("/home") is not allowed", stack: "Error at new NavigationDuplicated (webpack-int…/node_modules/vue/dist/vue.