title: How to give access to page in Vue.js only if a user is logged in / localStorage exists?
body: <p>I currently have a simple Vue.js application, I am using vue-router like this. <code>index.html</code></p>
  
  <pre><code>&lt;p&gt;
    &lt;router-link to="/" exact&gt; Home &lt;/router-link&gt;
    &lt;router-link to="/about"&gt; About &lt;/router-link&gt;
    &lt;router-link to="/contact"&gt; Contact &lt;/router-link&gt;
    &lt;router-link to="/login"&gt; Login &lt;/router-link&gt;
    &lt;router-link to="/register"&gt; Register &lt;/router-link&gt;
  &lt;/p&gt;
  &lt;router-view&gt;&lt;/router-view&gt;
  </code></pre>
  
  <p>And I have this in my <code>/routes.js</code></p>
  
  <pre><code>import VueRouter from 'vue-router';
  
  let routes = [
    {
      path: '/',
      component: require('./components/Home.vue')
    },
    {
      path: '/about',
      component: require('./components/About.vue')
    },
    {
      path: '/login',
      component: require('./components/Login.vue')
    },
    {
      path: '/register',
      component: require('./components/Register.vue')
    }
  ];
  
  export default new VueRouter({
    mode: 'history',
    routes
  });
  </code></pre>
  
  <p>I have <code>index.js</code> file which initialized the app, I think I should do something within my <code>created(){}</code> module but I am not sure how it is done. </p>
  
  <p>I can set/unset sessions, all I need to know is how to give access to a page only if this session exists. </p>