Преглед на файлове

delete api call added (not tested)

juan преди 1 месец
родител
ревизия
777dab2873
променени са 1 файла, в които са добавени 25 реда и са изтрити 1 реда
  1. 25 1
      lib/api_service.dart

+ 25 - 1
lib/api_service.dart

@@ -127,6 +127,30 @@ class ApiService {
       print('error making post req: $e');
     }
   }
+
+
+  Future<void> deleteFolder(String folderName) async {
+    var url = Uri.http('127.0.0.1:3001', 'delete_folder');
+
+    Map<String, String> requestBody = {'name': folderName};
+
+    try {
+      var response = await http.post(
+        url,
+        headers: {
+          'Content-Type': 'application/json',
+        },
+        body: jsonEncode(requestBody),
+      );
+      if (response.statusCode == 200) {
+        print('response body: ${response.body}');
+      } else {
+        print('Error: ${response.statusCode}, response body: ${response.body}');
+      }
+    } catch (e) {
+      print('error making post req: $e');
+    }
+  }
 }
 
 class EmailView extends StatefulWidget {
@@ -156,7 +180,7 @@ class _EmailViewState extends State<EmailView> {
   late Key iframeKey;
   late String currentContent;
   late String viewTypeId;
-  TextEditingController _jumpController = TextEditingController();
+  // TextEditingController _jumpController = TextEditingController();
 
   @override
   void initState() {