feat: add axiosCancel

This commit is contained in:
Qiuxia Fan
2021-12-15 17:39:56 +08:00
parent 1b30216545
commit b0f6194f0c
3 changed files with 26 additions and 8 deletions

View File

@@ -43,4 +43,16 @@ const router = createRouter({
routes,
});
(window as any).axiosCancel = [];
router.beforeEach((to, from, next) => {
const token = window.localStorage.getItem("skywalking-authority");
if ((window as any).axiosCancel.length !== 0) {
for (const func of (window as any).axiosCancel) {
setTimeout(func(), 0);
}
(window as any).axiosCancel = [];
}
next();
});
export default router;