Browse Source

delete api call added (not tested)

juan 1 month ago
parent
commit
777dab2873
1 changed files with 25 additions and 1 deletions
  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() {