I'm working the authentification part of a website, here is the method called when the user send the connexion form :
login() {
   this.$store.dispatch('RETRIEVE_TOKEN', {
        username: this.username,
        password: this.password,
    })
}
And the action :
RETRIEVE_TOKEN(context, credentials) {
  return new Promise((resolve, reject) => {
    axios.post('someurl/auth', {
       email: credentials.username,
       password: credentials.password
          })
          .then(response => {
              const token = response.data.key
              localStorage.setItem('key', token)
              context.commit('retrieveToken', token)
              resolve(response)
              this.$router.push('/backoffice')
          })
          .catch(error => {
             console.log(error);
             reject(error)
          });
        })
    }
My issue is that the this.$router.push('/backoffice') is called even if the user send the wrong password and usermail. I don't understand why. Can someone explain to me please?
 
    