text: import Vue from 'vue'
  import VueRouter from 'vue-router'
  import Authentication from '../views/Authentication.vue'
  import Home from '@/views/Home.vue'
  import store from '@/store'
  
  Vue.use(VueRouter)
  
  const routes = [
    {
      path: '/',
      name: 'Authentication',
      component: Authentication
    },
    {
      path: '/about',
      name: 'About',
      // 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/About.vue')
    },
    {
      path: '/home',
      name: 'Home',
      component: Home
    }
  ]
  
  const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
  })
  router.beforeEach((to, from, next) => {
    if (to.name === 'Authentication' && store.getters.isLoggedin)
      next({ name: 'Home' })
    else next()
  
    if (to.name !== 'Authentication' && !store.getters.isLoggedin)
      next({ name: 'Authentication' })
    else next()
  })
  
  export default router
  