saveDbConfig method

Future<Response> saveDbConfig(
  1. String agentId,
  2. Map<String, dynamic> dbConfig
)

Implementation

Future<http.Response> saveDbConfig(String agentId,Map<String, dynamic> dbConfig) async {
  final url = Uri.parse('$baseUrl1/saveHaivaAgentConfig?agent-id=${agentId}');
  print("agentid = ${agentId}");
  final response = await http.post(
    url,
    headers: {
      'Authorization': 'Bearer $token',
      'Content-Type': 'application/json',
    },
    body: json.encode(dbConfig),
  );

  if (response.statusCode == 200  || response.statusCode == 201) {
    print('db saved successfully');
    return response;

  } else {
    // Handle error
    throw Exception('Failed to update agent${response.body}');
  }
}