I want to build a simple function which forwards the browser to a specific destination if the route.name is Idx and if not, reloads the page. I use the following code and get the following error
I use vue 2-x.
Code
reloadPage() {
if (this.$route.name == "Idx") {
this.$router.push('/')
//console.log("test")
} else {
this.$router.go() // RELOAD THE PAGE TO OVERTAKE THE CHANGES
}
}
error
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/idx".
This error only appears when I run the function in the /idx site.
What do I miss?
Thanks!
window.location.reload();