import router from './index'
import { usePort } from '@/hooks/index'
import { useUserStore } from '@/store'
import { message } from 'ant-design-vue'
import { useRouter } from 'vue-router'

router.beforeEach((to, from, next) => {
  // if (to.path === '/login') {
  //   next()
  // } else if (useUserStore().userInfo.token) {
  //   next()
  // } else {
  //   message.error('登录失效，请重新登录')
  //   router.replace({ path: '/login', query: { redirectUrl: to.fullPath } })
  // }
  usePort(to.meta.title as string)
  next()
})
