fix(llc): add type check in auth_interceptor.dart

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2022-02-18 14:58:18 +05:30
committed by xsahil03x
parent ee4ea66de6
commit ca01ca28d5
@@ -49,10 +49,13 @@ class AuthInterceptor extends Interceptor {
DioError err,
ErrorInterceptorHandler handler,
) async {
ErrorResponse? error;
final data = err.response?.data;
if (data != null) error = ErrorResponse.fromJson(data);
if (error?.code == ChatErrorCode.tokenExpired.code) {
if (data == null || data is! Map<String, dynamic>) {
return handler.next(err);
}
final error = ErrorResponse.fromJson(data);
if (error.code == ChatErrorCode.tokenExpired.code) {
if (_tokenManager.isStatic) return handler.next(err);
_client.lock();
await _tokenManager.loadToken(refresh: true);