feat: 前端登录跳转问题
All checks were successful
Web Console Deploy (Vue 3 + Vite) / deploy (push) Successful in 1m10s
Backend Deploy (Go + Docker) / deploy (push) Successful in 1m44s

This commit is contained in:
zs
2026-03-03 01:33:12 +08:00
parent 235fc9c87f
commit c686d81d30
2 changed files with 7 additions and 3 deletions

View File

@@ -25,9 +25,11 @@ const handleLogin = async () => {
if (!res.ok) throw new Error('Invalid credentials')
const data = await res.json()
if (data.token) {
localStorage.setItem('jwt_token', data.token)
if (data.data && data.data.token) {
localStorage.setItem('jwt_token', data.data.token)
router.push('/dashboard')
} else {
throw new Error(data.message || 'Login failed')
}
} catch (err: any) {
errorMsg.value = err.message || 'Login failed'