chore: StackGuard
All checks were successful
CI / cache-and-install (push) Successful in 55s

This commit is contained in:
严浩
2024-08-10 16:41:48 +08:00
parent 0afdfc5d2c
commit d0ba655182
16 changed files with 251 additions and 181 deletions

View File

@ -1,26 +1,26 @@
import NProgress from 'nprogress'
import type { Router } from 'vue-router'
import { createLogGuard, createStackGuard } from './log-guard'
import NProgress from 'nprogress';
import type { Router } from 'vue-router';
import { createLogGuard, createStackGuard } from './log-guard';
// Don't change the order of creation
export function setupRouterGuard(router: Router) {
createProgressGuard(router)
createProgressGuard(router);
createLogGuard(router)
createLogGuard(router);
createStackGuard(router)
createStackGuard(router);
router.onError((error) => {
console.debug('🚨 [router error]: ', error)
})
console.debug('🚨 [router error]: ', error);
});
}
export function createProgressGuard(router: Router) {
router.beforeEach(() => {
NProgress.start()
})
NProgress.start();
});
router.afterEach(() => {
NProgress.done()
})
NProgress.done();
});
}