deleteUser method

Future<Either<String, void>> deleteUser(
  1. int id
)

Implementation

Future<Either<String, void>> deleteUser(int id) async {
  try {
    final response = await http.delete(
      Uri.parse('$baseUrl/$id'),
      headers: {'Content-Type': 'application/json'},
    );
    if (response.statusCode == 200) {
      return Right(null);
    } else {
      return Left('Error en eliminar usuario: ${response.statusCode}');
    }
  } catch (e) {
    return Left('Exception: $e');
  }
}