前台登陆逻辑修改,请帮我实现“单设备登录(同端互斥)”功能

This commit is contained in:
2026-08-13 09:37:39 +08:00
parent f38f9b09ab
commit 58e061c9e7
8 changed files with 116 additions and 11 deletions
+4
View File
@@ -114,6 +114,10 @@ if (!res.ok) {
if (typeof parsed?.detail === 'string') {
msg = parsed.detail;
}
// 检测"被踢出"错误 — 单设备登录互斥
if (res.status === 401 && typeof parsed?.detail === 'string' && parsed.detail.includes('其他设备登录')) {
window.dispatchEvent(new CustomEvent('kicked-out', { detail: { message: parsed.detail } }));
}
if (res.status === 401 && !options.skipAuthRedirect) {
clearToken();
window.location.href = '/login';