import router from './index'
import { useGlobalStore, useUserInfoStore } from '@/stores'


router.beforeEach((to, from, next) => {
	if (!to.meta.notToken && !useUserInfoStore().state.token) {
		return next({ name: 'login' })
	}
	useGlobalStore().setViewLoading(true)
	next()
})

router.afterEach(() => {
	useGlobalStore().setViewLoading(false)
})
