fix: app scan

This commit is contained in:
skytek_xinliang
2026-09-16 10:45:42 +08:00
parent 057bd335d6
commit ab8da775a6
6 changed files with 170 additions and 6 deletions
+21
View File
@@ -154,6 +154,27 @@ if (typeof window !== "undefined") {
});
}
});
// CSRF Token 刷新並重送後仍失敗時,回到登入頁並提示使用者重新整理。
window.addEventListener("csrf-recovery-required", () => {
const store = useAppStore();
const courseStore = useCourseStore();
const currentRoute = router.currentRoute.value;
const redirect =
currentRoute.name === "login"
? String(currentRoute.query.redirect ?? "")
: currentRoute.fullPath;
store.clearAuthentication();
courseStore.resetGroup();
void router.replace({
name: "login",
query: {
...(redirect ? { redirect } : {}),
csrf: "refresh",
},
});
});
}
export default router;