title: Vuex and routing - Redirection after sign in
body: <p>I'm using vuex and laravel as backend for my project.
  <br>
  Redirection after signing in is not working. here is my code :
  <br></p>
  
  <pre><code>methods: {
      submit () {
        this.$validator.validateAll()
        if (!this.errors.any()) {
          this.$store.dispatch('SIGNIN', this.user)
          this.$router.push({name: 'chat'})
        }
      }
  }
  </code></pre>
  
  <p><br>
  For Vuex :
  <br>
  <br></p>
  
  <pre><code>actions: {
      SIGNIN (context, user) {
        context.commit('handleLoader')
        Vue.http.post(apiDomain + signInUrl, user, {headers: getHeaders})
        .then(response =&gt; {
          if (response.status === 200) {
            Vue.auth.setToken(response.body.token)
            Vue.auth.setAuth(response.body.user)
            context.commit('handleLoader')
            // context.commit('navigateAfterSignIn')
          }
        })
      }
  }
  </code></pre>
  
  <p>And my mutation</p>
  
  <pre><code> mutations: {
      signin (state) {
        state.isLoggedIn = true
      }
    }
  </code></pre>
  
  <p><br></p>
  
  <p>My routes :</p>
  
  <pre><code>export default new Router({
    routes: [
      {
        path: '/',
        name: 'chat',
        component: Chat,
        meta: {
          forAuth: true
        }
      },
      {
        path: '/signin',
        name: 'signin',
        component: Signin,
        meta: {
          forVisitors: true
        }
      },
      {
        path: '/signup',
        name: 'signup',
        component: Signup,
        meta: {
          forVisitors: true
        }
      }
    ],
    mode: 'history'
  })
  </code></pre>
  
  <p>And my check for routes protections</p>
  
  <pre><code>router.beforeEach(
    (to, from, next) =&gt; {
      if (to.matched.some(record =&gt; record.meta.forVisitors)) {
        if (Vue.auth.isAuthenticated()) {
          next({
            path: '/'
          })
        } else next()
      } else if (to.matched.some(record =&gt; record.meta.forAuth)) {
        if (!Vue.auth.isAuthenticated()) {
          next({
            path: '/signin'
          })
        } else next()
      } else next()
    }
  )
  </code></pre>
  
  <p>How to redirect automatically?? 
  <br>
  Thanks for your help</p>