fix: login page now shows error message on wrong password

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
seaislee1209 2026-02-12 18:44:02 +08:00
parent 56ea51fb8b
commit e751418540

View File

@ -24,7 +24,9 @@ api.interceptors.response.use(
if (err.response?.status === 401) {
const isOnLogin = window.location.pathname === '/login'
localStorage.removeItem('token')
if (!isOnLogin) {
if (isOnLogin) {
ElMessage.error(msg || '用户名或密码错误')
} else {
router.push('/login')
ElMessage.error('登录已过期,请重新登录')
}