setThumbnailForCrmLead method
Future<NetworkResponse>
setThumbnailForCrmLead(
- dynamic bytes,
- dynamic path,
- dynamic uuid
override
Implementation
@override
Future<NetworkResponse> setThumbnailForCrmLead(bytes, path, uuid) async {
bool isDisconnect = await WifiService.isDisconnectWhenCallApi();
if (isDisconnect) return NetworkResponse.withDisconnect();
try {
String fileName = path.split('/').last;
FormData data = FormData.fromMap({
'uuid': uuid,
"fileName": MultipartFile.fromBytes(bytes, filename: fileName),
});
Response response = await AppClients(
requiredToken: true, token: await appPrefs.getNormalToken())
.post(AppEndpoint.setThumbnailForCrmLead(), data: data);
return NetworkResponse.fromResponse(response,
converter: (json) => json['fileName']);
} on DioError catch (e) {
appDebugPrint('DioError: $e');
return NetworkResponse.withErrorRequest(e);
} catch (e) {
return NetworkResponse.withErrorConvert(e);
}
}