Retrofit classes implemented with interceptor and base features

This commit is contained in:
2022-09-29 22:41:22 +01:00
parent d5a906d998
commit 057c6284ce
11 changed files with 53 additions and 18 deletions

View File

@@ -11,7 +11,7 @@ mixin SafeApiCall {
HttpResponse<T> httpResponse = await apiCall;
return httpResponse.data;
} on DioError catch(dioError) {
Map<String, dynamic>? errorResponse = dioError.response?.data;
Map<String, dynamic>? errorResponse = dioError.response?.data?["error"];
String error;
if (errorResponse?["error"] != null){
@@ -21,7 +21,6 @@ mixin SafeApiCall {
} else {
error = "Failed to retrieve data from api";
}
logger.e(dioError.error);
throw HttpException(error);