问题:
- 使用window.location.href会导致整页刷新,影响用户体验
- Vue应用应使用router.push实现单页应用内的路由跳转
修复:
1. http.js:
- 导入router实例
- 401错误:router.push('/login')
- 403错误:router.push('/login')
2. AuthService.js:
- 导入router实例
- logout函数:router.push('/login')
效果:
- 页面跳转更流畅,用户体验更佳
- 保持应用状态,避免不必要的重新加载
- 符合Vue单页应用的最佳实践
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>