增加显示IP地理位置的功能

This commit is contained in:
Alex Yang
2025-11-30 12:46:22 +08:00
parent dadfd4c78d
commit ed719255b7
7 changed files with 254 additions and 64 deletions

View File

@@ -161,7 +161,11 @@
})
.then(response => {
if (!response.ok) {
throw new Error('登录失败');
if (response.status === 401) {
throw new Error('未知用户名或密码');
} else {
throw new Error('登录失败');
}
}
return response.json();
})
@@ -170,7 +174,11 @@
// 登录成功,重定向到主页
window.location.href = '/';
} else {
throw new Error(data.error || '登录失败');
if (data.error === '用户名或密码错误') {
throw new Error('未知用户名或密码');
} else {
throw new Error(data.error || '登录失败');
}
}
})
.catch(error => {