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

// const useRouterTravel = useRouterTravelStore()

router.beforeEach((to, from, next) => {
  usePort(to.meta.title as string)
  if (from.path !== '/login') {
    useRouterTravelStore().push(to as any)
  }
  next()
})

router.afterEach((to, from, failure) => {
  // useRouterTravelStore().end()
})
