title: How to solve the error "Redirected when going from ' / ' to '/dashboard' via a navigation guard"?
body: <p>When I login with a user, it redirects me to the dashboard as expected. As soon as I logout and try to login again (even with another user, and WITHOUT refreshing the page) it gives me back this error in console:</p>
  <p><a href="https://i.stack.imgur.com/9h1Y9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9h1Y9.jpg" alt="enter image description here" /></a></p>
  <p>I just want to redirect the user in the dashboard if authenticated, even when the page is not refreshed cause I did notice that if I refresh the page I can login without problems.</p>
  <p>Help me if you can. Down here some code:</p>
  <p>Login method</p>
  <pre><code>methods: {
      ...mapActions({
      attempt: &quot;auth/attempt&quot;,
      }),
  
      submit(credentials) {
        axios
          .post(&quot;http://127.0.0.1:8000/api/login&quot;, credentials)
          .then((res) =&gt; {
            // console.log(res.data);
            if (res.data.success) {
              
              this.attempt(res.data.token)
            }
  
            if (res.data.errors) {
              this.loginErrors = res.data.errors;
            } else {
              this.$router.push({ name: 'dashboard' })
            }
  
            
          })
          .catch((err) =&gt; {
            if (
              err.name !== &quot;NavigationDuplicated&quot; &amp;&amp;
              !err.message.includes(
                &quot;Avoided redundant navigation to current location&quot;
              )
            ) {
              
              console.log(err);
            }
          });
      },
    },
  </code></pre>
  <p>dashboard path in the router</p>
  <pre><code>        {
              path: '/dashboard',
              name: 'dashboard',
              component: DashboardComponent,
              beforeEnter: (to, from, next) =&gt; {
                  if (!store.getters['auth/authenticated']) {
                      return next({
                          name: 'home'
                      })
                  }
                  next()
              }
          },
  </code></pre>
  <p>attempt action in vuex store</p>
  <pre><code>async attempt({ commit, state }, token) {
              if (token) {
                  commit('SET_TOKEN', token)
              }
  
              // se non c'è
              if(!state.token) {
                  return
              }
              
              try {
                  await axios.get('http://127.0.0.1:8000/api/user')
                      .then(res =&gt; {
                          commit('SET_USER', res.data)
                      })
              } catch (e) {
                  commit('SET_TOKEN', null)
                  commit('SET_USER', null)
              }
          },
  </code></pre>
  <p>others from vuex</p>
  <pre><code>namespaced: true,
      state: {
          token: null,
          form: null,
      },
  
      getters: {
          authenticated(state) {
              return state.token &amp;&amp; state.form
          },
  
          user(state) {
              return state.form
          },
      },
  
      mutations: {
          SET_TOKEN(state, token) {
              state.token = token
          },
  
          SET_USER(state, data) {
              state.form = data
          },
  
      },
  </code></pre>