前台登陆逻辑修改,请帮我实现“单设备登录(同端互斥)”功能
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user