This commit is contained in:
zlwu committed 2026-06-14 09:14:11 +08:00
1 parent 5ad07c8cac
commit a79aee2614
61 files changed
+9220 -9348

No files matched your search

+6 -2
View File
@@ -109,9 +109,13 @@ export const useUserStore = defineStore(
* 通知后端撤销 Redis 会话,然后清空所有用户相关状态并跳转到登录页
*/
const logOut = async () => {
// 先通知后端撤销 Redis 会话(不等待结果,失败也不阻塞退出)
// 先通知后端撤销 Redis 会话(须在清空 token 之前完成,否则请求无 Authorization)
if (accessToken.value) {
fetchLogout().catch(() => {})
try {
await fetchLogout()
} catch {
// 登出接口失败不阻塞本地退出
}
}
// 保存当前用户 ID,用于下次登录时判断是否为同一用户