Casper Veneman
Casper Veneman

Reputation: 23

Vuejs router push does not refresh page if it is already openend

so i am working on a school project and when i try to load a view using this.$router.push() it works fine, but if that view is already loaded it does not refresh it which is neccesary if i want to make api calls again.

how can i make it so it loads mounted again or an alternative solution.

code:

   mounted() {
     if (this.pokemonId >= 1){
       this.fetchData()
     } else {
       this.fetchDataAlternative()
     }
     this.fetchNames()
     this.getColor()
   },


   created() {
    if (this.$route.params >= 1){
      this.pokemonId = this.$route.params.query
      this.fetchData()
    } else {
      this.pokemonName = this.$route.params.query
      this.fetchDataAlternative()
    }
     this.fetchNames()
     this.getColor()
  }

Upvotes: 0

Views: 4413

Answers (0)

Related Questions