title: Why "Redirected when going from "/login" to "/" via a navigation guard." is appearing?
body: <p>Here the router guard is working fine on my vue app, but after logging in, the following error appears on console.</p>
  <blockquote>
  <p><em>Uncaught (in promise) Error: Redirected when going from &quot;/login&quot; to &quot;/&quot; via a navigation guard.</em></p>
  </blockquote>
  <p>Here is my code snippet.</p>
  <pre><code>const routes = [
    {
      path: &quot;/login&quot;,
      component: () =&gt; import(&quot;../views/Auth/Login&quot;),
      meta: { hideForAuth: true },
    },
    {
      path: &quot;/&quot;,
      component: DashboardLayout,
      meta: { requiresAuth: true },
      children: [
        {
          path: &quot;home&quot;,
          name: &quot;Home&quot;,
          component: () =&gt; import(&quot;../views/Home&quot;),
        },
      ],
    },
  ];
  
  </code></pre>
  <p>The Auth guard:</p>
  <pre><code>const loggedIn = localStorage.getItem(&quot;auth&quot;);
  
  router.beforeEach((to, from, next) =&gt; {
    if (to.matched.some((record) =&gt; record.meta.requiresAuth)) {
      if (!loggedIn) {
        next({ path: &quot;/login&quot; });
      } else {
        next();
      }
    } else {
      next();
    }
  
    if (to.matched.some((record) =&gt; record.meta.hideForAuth)) {
      if (loggedIn) {
        next({ path: &quot;//&quot; });
      } else {
        next();
      }
    } else {
      next();
    }
  });
  </code></pre>
  <p>Can't figure out the problem. Thanks in advance !</p>