Sign page: added user check for accepting notes of a delivery
This commit is contained in:
@ -19,7 +19,7 @@ import '../../../../util.dart';
|
||||
import '../../../authentication/exceptions.dart';
|
||||
|
||||
class NoteService extends ErpFrameService {
|
||||
NoteService({required super.config});
|
||||
NoteService({required super.backendUrl});
|
||||
|
||||
Future<void> deleteNote(int noteId) async {
|
||||
try {
|
||||
@ -210,20 +210,31 @@ class NoteService extends ErpFrameService {
|
||||
}
|
||||
|
||||
String uploadId = data["uploadId"];
|
||||
http.MultipartRequest request =
|
||||
http.MultipartRequest("POST", Uri.parse("$basePath/$uploadId"));
|
||||
http.MultipartRequest request = http.MultipartRequest(
|
||||
"POST",
|
||||
Uri.parse("$basePath/$uploadId"),
|
||||
);
|
||||
|
||||
HashMap<String, String> header = HashMap();
|
||||
header["Content-Type"] = "multipart/form-data";
|
||||
header.addAll(getSessionOrThrow());
|
||||
|
||||
request.headers.addAll(header);
|
||||
request.files.add(http.MultipartFile.fromBytes("file", bytes,
|
||||
request.files.add(
|
||||
http.MultipartFile.fromBytes(
|
||||
"file",
|
||||
bytes,
|
||||
filename: filename,
|
||||
contentType: MediaType.parse(mimeType ?? "application/octet-stream")));
|
||||
contentType: MediaType.parse(mimeType ?? "application/octet-stream"),
|
||||
),
|
||||
);
|
||||
|
||||
http.Response fileUploadResponse = await http.Response.fromStream(await request.send());
|
||||
Map<String, dynamic> fileUploadResponseJson = jsonDecode(fileUploadResponse.body);
|
||||
http.Response fileUploadResponse = await http.Response.fromStream(
|
||||
await request.send(),
|
||||
);
|
||||
Map<String, dynamic> fileUploadResponseJson = jsonDecode(
|
||||
fileUploadResponse.body,
|
||||
);
|
||||
|
||||
debugPrint("UPLOAD IMAGE RESPONSE: ${fileUploadResponse.body}");
|
||||
|
||||
@ -233,7 +244,10 @@ class NoteService extends ErpFrameService {
|
||||
throw NoteImageAddException();
|
||||
}
|
||||
|
||||
var fileCommitResponse = await http.patch(Uri.parse("$basePath/$uploadId"), headers: getSessionOrThrow());
|
||||
var fileCommitResponse = await http.patch(
|
||||
Uri.parse("$basePath/$uploadId"),
|
||||
headers: getSessionOrThrow(),
|
||||
);
|
||||
debugPrint("FILE COMMIT BODY: ${fileCommitResponse.body}");
|
||||
var fileCommitResponseJson = jsonDecode(fileCommitResponse.body);
|
||||
|
||||
@ -251,7 +265,7 @@ class NoteService extends ErpFrameService {
|
||||
try {
|
||||
return urls.map((url) async {
|
||||
return (await http.get(
|
||||
Uri.parse("${config.backendUrl}$url"),
|
||||
Uri.parse("$backendUrl$url"),
|
||||
headers: getSessionOrThrow(),
|
||||
)).bodyBytes;
|
||||
}).toList();
|
||||
|
||||
Reference in New Issue
Block a user