fix: token过期自动跳转登录页
- dio_client.dart: 401错误时触发onUnauthorized回调 - main.dart: 连接回调到AuthProvider.forceLogout - 完整链路: 401 -> 清除token -> 强制登出 -> 显示LoginPage
This commit is contained in:
@@ -119,6 +119,12 @@ class AuthProvider extends ChangeNotifier {
|
||||
_isLoggedIn = false;
|
||||
}
|
||||
|
||||
/// 强制登出(token 过期时由 DioClient 回调触发)
|
||||
void forceLogout() {
|
||||
_clearAuthState();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 刷新用户信息
|
||||
Future<void> refreshUserInfo() async {
|
||||
if (!_isLoggedIn) return;
|
||||
|
||||
Reference in New Issue
Block a user