deleteAgent method

Future<void> deleteAgent(
  1. String id
)

Implementation

Future<void> deleteAgent(String id) async {
  final response = await http.delete(
    Uri.parse('$baseUrl/deleteHaivaAgent?agentId=$id'),
    headers: {
      'Authorization': 'Bearer $token',
      'Content-Type': 'application/json',
    },
  );

  if (response.statusCode == 200) {
    // Successfully deleted
    print('Agent deleted successfully');
  } else {
    // Handle error
    throw Exception('Failed to delete agent');
  }
}