upvoteComment method
Implementation
Future<int> upvoteComment(int commentId) async {
try {
final response = await _dio.get('comments/upvote/$commentId');
if (response.statusCode == 200) {
final data = response.data;
final votes = data['votes'] as int;
print("Comment vote incremented successfully");
return votes;
} else {
print("Failed to increment comment votes: ${response.statusCode}");
throw Exception('Failed to increment comment votes');
}
} catch (error) {
print("Error incrementing comment votes: $error");
throw Exception('Error incrementing comment votes');
}
}