mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-26 00:24:31 +08:00
fix: 防止 /logout 死循环
This commit is contained in:
@@ -78,11 +78,17 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isLoggingOut = false; // 正在 logout 标识, 防止 /logout 死循环.
|
||||||
|
|
||||||
async function logout(redirect: boolean = true) {
|
async function logout(redirect: boolean = true) {
|
||||||
|
if (isLoggingOut) return;
|
||||||
|
isLoggingOut = true;
|
||||||
try {
|
try {
|
||||||
await logoutApi();
|
await logoutApi();
|
||||||
} catch {
|
} catch {
|
||||||
// 不做任何处理
|
// 不做任何处理
|
||||||
|
} finally {
|
||||||
|
isLoggingOut = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
resetAllStores();
|
resetAllStores();
|
||||||
|
|||||||
Reference in New Issue
Block a user