text: import Vue from 'vue'
  import Router from 'vue-router'
  import Home from './views/Home.vue'
  
  import store from './store'
  
  Vue.use(Router)
  
  const router = new Router({
    routes: [
      {
        path: '/',
        name: 'home',
        component: Home
      },
      {
        path: '/docs',
        name: 'docs',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ './views/Docs.vue'),
        meta: { requiresLogin: true }
      },
      {
        path: '/doc/:doc_id',
        name: 'doc',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ './views/Doc.vue'),
        props: true,
        meta: { requiresLogin: true }
      }
    ]
  })
  
  router.beforeEach((to, from, next) => {
    if (to.matched.some(record => record.meta.requiresLogin) && !store.getters.isAuthenticated) {
      // You can use store variable here to access globalError or commit mutation
      next("/")
    } else {
      next()
    }
  })
  
  export default router
  