From f9fd6d374bfa842ae3402fe8b8ed0d085966f6d0 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Tue, 20 May 2025 11:48:44 +0200 Subject: [PATCH] update flutter file api --- Frontend/lib/mih_apis/mih_file_api.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Frontend/lib/mih_apis/mih_file_api.dart b/Frontend/lib/mih_apis/mih_file_api.dart index cbc4f060..3324dd44 100644 --- a/Frontend/lib/mih_apis/mih_file_api.dart +++ b/Frontend/lib/mih_apis/mih_file_api.dart @@ -57,6 +57,7 @@ class MihFileApi { static Future uploadFile( String app_id, + String env, String folderName, PlatformFile? file, BuildContext context, @@ -69,6 +70,7 @@ class MihFileApi { request.headers['Authorization'] = 'Bearer $token'; request.headers['Content-Type'] = 'multipart/form-data'; request.fields['app_id'] = app_id; + request.fields['env'] = env; request.fields['folder'] = folderName; request.files.add(await http2.MultipartFile.fromBytes('file', file!.bytes!, filename: file.name.replaceAll(RegExp(r' '), '-'))); @@ -79,6 +81,7 @@ class MihFileApi { static Future deleteFile( String app_id, + String env, String folderName, String fileName, BuildContext context, @@ -91,7 +94,10 @@ class MihFileApi { headers: { "Content-Type": "application/json; charset=UTF-8" }, - body: jsonEncode({"file_path": filePath}), + body: jsonEncode({ + "file_path": filePath, + "env": env, + }), ); Navigator.of(context).pop(); // Pop loading dialog return response.statusCode;