import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import element from '@/common/components/element-ui.js'
import vxeTable from '@/common/components/vxeTable.js'
import './common/style/index.scss'
// import { getToken } from '@/utils/auth'

Vue.config.productionTip = false

Vue.use(element)
Vue.use(vxeTable)

router.afterEach((to, from) => {
  if (to.path === '/login') return
  store.commit('tags/add', {
    name: to.name,
    path: to.fullPath,
    title: to.meta?.title || to.name,
  })
  store.commit('tags/setActive', to.name)
})

router.beforeEach((to, form, next) => {
  // const auth = getToken()
  // if (!auth && to.path !== '/login') {
  //   next({ path: '/login' })
  // } else {
  //   next()
  // }
  next()
})

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app')
