import router from './index'

// 白名单页面直接进入
const whiteList = ['/login']
console.log(whiteList)

router.beforeEach((to, from, next) => {
	requestAnimationFrame(() => {
		const verify = to.meta?.verify;
		if (typeof verify === 'function') {
			const res = verify()
			if (res === false) {
				return next(false)
			} else if (typeof res === 'string') {
				console.log(res)
				return next({ path: res })
			}
		}
		next()
	})
})

router.afterEach(() => {
	// finish progress bar
	//   NProgress.done()
})
