26-5-2
This commit is contained in:
@@ -483,11 +483,13 @@ class ScanDocumentsByApi extends GetxController {
|
||||
} else {}
|
||||
}
|
||||
|
||||
// Todo upload images and fields
|
||||
Future<String> uploadImagePortrate() async {
|
||||
isLoading = true;
|
||||
update();
|
||||
|
||||
final String token = box.read(BoxName.jwt)?.toString().split(AppInformation.addd)[0] ?? '';
|
||||
final String fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? '';
|
||||
|
||||
var request = http.MultipartRequest(
|
||||
'POST',
|
||||
Uri.parse(AppLink.uploadImagePortrate),
|
||||
@@ -498,22 +500,18 @@ class ScanDocumentsByApi extends GetxController {
|
||||
);
|
||||
|
||||
request.headers.addAll({
|
||||
"Content-Type": "multipart/form-data",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
|
||||
'Authorization': 'Bearer $token',
|
||||
'X-Device-FP': fingerPrint,
|
||||
});
|
||||
request.fields['driverID'] = box.read(BoxName.driverID).toString();
|
||||
|
||||
var response = await request.send();
|
||||
|
||||
var responseData = await response.stream.toBytes();
|
||||
var responseString = String.fromCharCodes(responseData);
|
||||
|
||||
isLoading = false;
|
||||
update();
|
||||
|
||||
// Print the response string
|
||||
|
||||
return responseString;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user