title: Vue-Router: Refresing(F5) current page
body: <p>When I press refresh(F5) button then my router directs me to the main page. How do I stay on the same page when the page is refreshed? </p>
  
  <p>that's route, mode is 'history'</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const routes = [
     { path: '*', redirect: '/'  }, 
    {
      path: '/', component: template_Default, redirect: '/Login',
      children: [
        { path: 'Login', component: login_, name: 'Login' },
        { path: 'SignUp', component: signUp_, name: 'SignUp' }
      ]
    },
    {
      path: '/Main', component: template_Home, name: 'Main', redirect: '/Main/Overview',
      children: [
        { path: 'Overview', component: overview_, name: 'Overview' },
        { path: 'Customer', component: customer_, name: 'Customer' },
        { path: 'Task', component: task_, name: 'Task' },
        { path: 'Order', component: order_, name: 'Order' },
        { path: 'Product', component: product_, name: 'Product' },
        { path: 'Setting', component: setting_, name: 'Setting' }
      ]
    },
    {
      path: '/ForgotPassword', component: forgotPassword_, name: 'ForgotPassword', 
      // redirect: '/ForgotPassword/GetEmail',
      // children: [
      //   { path: 'GetEmail', component: forgotPasswordGetEmail, name: 'GetEmail' },
      //   { path: 'ReSend', component: forgotPasswordReSend, name: 'ReSend' }
  
      // ]
    }
  ]</code></pre>
  </div>
  </div>
  </p>
  
  <p>And my controller,</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>router.beforeEach((to, from, next) =&gt; {
      // redirect to login page if not logged in and trying to access a restricted page
      const publicPages = ['/Login','/SignUp','/ForgotPassword'];
      const authRequired = !publicPages.includes(to.path);
      const loggedIn = store.getters.isLoggedIn;
      
      if (authRequired &amp;&amp; !loggedIn) {
        return next('/Login');
      }else next();
      if(loggedIn){
        AuthController.IsOnline();
      }
      
    })</code></pre>
  </div>
  </div>
  </p>
  
  <p>thanks in advance..</p>