title: How to solve Avoided redundant navigation to current location error in vue?
body: <p>I am new in vue and i got the error after user logged in and redirect to another route.
  Basically i am a PHP developer and i use laravel with vue. Please help me to solve this error.</p>
  
  <blockquote>
    <p>Uncaught (in promise) Error: Avoided redundant navigation to current location: "/admin".</p>
  </blockquote>
  
  <p>Here is the screenshot too</p>
  
  <p><a href="https://i.stack.imgur.com/voGpF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/voGpF.png" alt="enter image description here"></a></p>
  
  <p><strong>Vue Code</strong></p>
  
  <pre><code> methods: {
          loginUser() {
              var data = {
                  email: this.userData.email,
                  password: this.userData.password
              };
              this.app.req.post("api/auth/authenticate", data).then(res =&gt; {
                  const token = res.data.token;
                  sessionStorage.setItem("chatbot_token", token);
                  this.$router.push("/admin");
              });
          }
      }
  </code></pre>
  
  <p><strong>Vue Routes</strong></p>
  
  <pre><code>const routes = [
      {
          path: "/admin",
          component: Navbar,
          name: "navbar",
          meta: {
              authGuard: true
          },
          children: [
              {
                  path: "",
                  component: Dashboard,
                  name: "dashboard"
              },
              {
                  path: "users",
                  component: Users,
                  name: "user"
              }
          ]
      },
      {
          path: "/login",
          component: Login,
          name: "login"
      }
  ];
  
  const router = new VueRouter({
      routes,
      mode: "history"
  });
  
  router.beforeEach((to, from, next) =&gt; {
      const loggedInUserDetail = !!sessionStorage.getItem("chatbot_token");
      if (to.matched.some(m =&gt; m.meta.authGuard) &amp;&amp; !loggedInUserDetail)
          next({ name: "login" });
      else next();
  });
  
  </code></pre>