title: vue router next() function don't work in Promise in router.beforeEach
body: <p>I have the following code:</p>
  
  <pre><code>router.beforeEach((to, from, next) =&gt; {
    if (to.name !== from.name) {
      store
        .dispatch("fetchCurrentUser")
        .then(() =&gt; {
          console.log('then');
          // do something
          next();
        })
        .catch(() =&gt; {
          console.log('catch');
          router.push("/login");
          next();
      });
    } else {
      next();
    }
    // next();
  });
  </code></pre>
  
  <p>I'm trying to get the current user, and if this succeeds, then do something with this data, and if the request is not successful, then redirect the user to the login page. But next () calls do not work, I get the "then" or "catch" in the console, but the redirect does not occur and an infinite loop begins. But if I take next () from condition (commented row) the redirect works fine.</p>