fix: login page now shows error message on wrong password
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
56ea51fb8b
commit
e751418540
@ -24,7 +24,9 @@ api.interceptors.response.use(
|
|||||||
if (err.response?.status === 401) {
|
if (err.response?.status === 401) {
|
||||||
const isOnLogin = window.location.pathname === '/login'
|
const isOnLogin = window.location.pathname === '/login'
|
||||||
localStorage.removeItem('token')
|
localStorage.removeItem('token')
|
||||||
if (!isOnLogin) {
|
if (isOnLogin) {
|
||||||
|
ElMessage.error(msg || '用户名或密码错误')
|
||||||
|
} else {
|
||||||
router.push('/login')
|
router.push('/login')
|
||||||
ElMessage.error('登录已过期,请重新登录')
|
ElMessage.error('登录已过期,请重新登录')
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user