folders actions #5
					 1 changed files with 27 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -143,10 +143,32 @@ class ApiService {
 | 
			
		|||
    return content;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // void _addMailBox async(BuildContext context){
 | 
			
		||||
  //   //add email folder
 | 
			
		||||
  //   showDialog(context: context, builder: builder)
 | 
			
		||||
  // }
 | 
			
		||||
  Future<bool> moveEmail(String fromFolder, String uID, String toFolder) async {
 | 
			
		||||
    var url = Uri.http('$ip:$port', 'move_email');
 | 
			
		||||
    Map<String, String> requestBody = {
 | 
			
		||||
      'from': fromFolder,
 | 
			
		||||
      'uid': uID,
 | 
			
		||||
      'to': toFolder,
 | 
			
		||||
    };
 | 
			
		||||
    try {
 | 
			
		||||
      var response = await http.post(
 | 
			
		||||
        url,
 | 
			
		||||
        headers: {
 | 
			
		||||
          'Content-Type': 'application/json',
 | 
			
		||||
        },
 | 
			
		||||
        body: jsonEncode(requestBody),
 | 
			
		||||
      );
 | 
			
		||||
      if (response.statusCode == 200) {
 | 
			
		||||
        print('response body ${response.body}');
 | 
			
		||||
        return true;
 | 
			
		||||
      } else {
 | 
			
		||||
        print('error ');
 | 
			
		||||
      }
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      print(e);
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Future<List<String>> fetchFolders() async {
 | 
			
		||||
    try {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue