|
|
@@ -1,6 +1,8 @@
|
|
|
import 'dart:async';
|
|
|
|
|
|
import 'package:electronic_assistant/base/base_response.dart';
|
|
|
+import 'package:electronic_assistant/data/consts/error_code.dart';
|
|
|
+import 'package:electronic_assistant/data/repositories/account_repository.dart';
|
|
|
|
|
|
class HttpHandler {
|
|
|
static FutureOr<T> Function(BaseResponse<T> value) handle<T>(
|
|
|
@@ -13,6 +15,9 @@ class HttpHandler {
|
|
|
throw Exception('data is null');
|
|
|
}
|
|
|
} else {
|
|
|
+ if (response.code == ErrorCode.errorCodeNoLogin) {
|
|
|
+ accountRepository.logout();
|
|
|
+ }
|
|
|
throw ServerErrorException(response.code, response.message);
|
|
|
}
|
|
|
};
|