feat : segment page
This commit is contained in:
@@ -6,7 +6,6 @@ class DioRemote implements IHttpClient {
|
||||
late Dio dio;
|
||||
final AppInterceptor interceptors;
|
||||
|
||||
|
||||
DioRemote({this.baseUrl, required this.interceptors});
|
||||
|
||||
@override
|
||||
@@ -90,6 +89,7 @@ class DioRemote implements IHttpClient {
|
||||
Map<String, String>? headers,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
T Function(Map<String, dynamic> json)? fromJson,
|
||||
}) async {
|
||||
final response = await dio.put(
|
||||
path,
|
||||
@@ -100,6 +100,11 @@ class DioRemote implements IHttpClient {
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
cancelToken: ApiHandler.globalCancelToken,
|
||||
);
|
||||
|
||||
if (fromJson != null && response.data is Map<String, dynamic>) {
|
||||
response.data = fromJson(response.data);
|
||||
return DioResponse<T>(response);
|
||||
}
|
||||
return DioResponse<T>(response);
|
||||
}
|
||||
|
||||
@@ -109,6 +114,7 @@ class DioRemote implements IHttpClient {
|
||||
dynamic data,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
Map<String, String>? headers,
|
||||
T Function(Map<String, dynamic> json)? fromJson,
|
||||
}) async {
|
||||
final response = await dio.delete<T>(
|
||||
path,
|
||||
|
||||
Reference in New Issue
Block a user