[Vuejs]-Vue.js Vue-router weird behaviour on browser reload page

0👍

It’s a collateral effect of my firebase.auth().onAuthStateChanged((user)) funcction..

    firebase.auth().onAuthStateChanged((user) => {
      if (user) {
        this.$router.push('/member')
      } else {
        this.$router.push('/home')
      }
    })

I should write it :

firebase.auth().onAuthStateChanged((user) => {
  if (user) {
    this.$router.push('/member')
  } else {
    this.$router.push('/users')
  }
})

this function is called whenever I reload the current page…

Leave a comment