submitNewComment method
Implementation
Future<Map<String, dynamic>> submitNewComment(
int taskId, String content) async {
try {
final response = await _dio.get('tasks/comment/create', queryParameters: {
'taskId': taskId,
'content': content,
});
if (response.statusCode == 200 || response.statusCode == 201) {
final data = response.data['comment'] as Map<String, dynamic>;
print("Comment submitted successfully");
return data;
} else {
print("Failed to submit comment: ${response.statusCode}");
throw Exception('Failed to submit comment');
}
} catch (error) {
print("Error submitting comment: $error");
throw Exception('Error submitting comment');
}
}