title: Redirect using Vue Router in Nuxt JS vuex
body: <p>I'm building a login/register system as part of an app. I'm using Firebase and Vuex to handle authentication and database information. I have some actions in Nuxt JS that create the user, sign them in and log them out.</p>
  
  <p>I'm trying to implement a redirect after the user has been successfully registered / when they click login, my code is:</p>
  
  <pre><code>export const actions = {
  
    /*
     * Create a user
     */
    createUser ({commit}, payload) {
      this.$fireAuth.createUserWithEmailAndPassword(payload.email, payload.password).then(function(firebaseUser) {
        commit('setUser', payload)
      }).catch(function(error) {
        console.log('error logging in' + error)
      });
    },
  
    /*
     * Log a user into Beacon
     */
    login ({commit}, payload) {
      this.$fireAuth.signInWithEmailAndPassword(payload.email, payload.password).then(function(firebaseUser) {
        commit('setUser', payload)
      }).catch(function(error) {
        console.log('error logging in' + error)
      });
    },
  
    /*
     * Sign a user out of Beacon
     */
    signOut ({commit}) {
      this.$fireAuth.signOut().then(() =&gt; {
        commit('setUser', null)
      }).catch(err =&gt; console.log(error))
    }
  
  }
  </code></pre>
  
  <p>I'm using Nuxt JS 2.9.2, on Vue JS 2.6.10</p>
  
  <p>I have a few modules.</p>
  
  <p>I've tried using <code>this.router.push('/')</code> and <code>window.location.href</code>, but would like to retain the SPA functionality.</p>