From 48ed7970554af522dae847de7b6a92bb26d1cb0c Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 9 Jan 2026 22:38:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=98=B2=E6=AD=A2=20/logout=20=E6=AD=BB?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playground/src/store/auth.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/playground/src/store/auth.ts b/playground/src/store/auth.ts index 4adeb76e1..9d461d153 100644 --- a/playground/src/store/auth.ts +++ b/playground/src/store/auth.ts @@ -78,11 +78,17 @@ export const useAuthStore = defineStore('auth', () => { }; } + let isLoggingOut = false; // 正在 logout 标识, 防止 /logout 死循环. + async function logout(redirect: boolean = true) { + if (isLoggingOut) return; + isLoggingOut = true; try { await logoutApi(); } catch { // 不做任何处理 + } finally { + isLoggingOut = false; } resetAllStores();