fix: token过期自动跳转登录页

- dio_client.dart: 401错误时触发onUnauthorized回调
- main.dart: 连接回调到AuthProvider.forceLogout
- 完整链路: 401 -> 清除token -> 强制登出 -> 显示LoginPage
This commit is contained in:
2026-04-01 11:26:07 +08:00
parent ed98db66cf
commit 3f4d2d8b9a
5 changed files with 8407 additions and 8374 deletions

View File

@@ -119,6 +119,12 @@ class AuthProvider extends ChangeNotifier {
_isLoggedIn = false;
}
/// 强制登出token 过期时由 DioClient 回调触发)
void forceLogout() {
_clearAuthState();
notifyListeners();
}
/// 刷新用户信息
Future<void> refreshUserInfo() async {
if (!_isLoggedIn) return;