fetchComments method
Implementation
Future<void> fetchComments(String postId) async {
final token = await CommunityStorage.getAuthToken();
try {
isLoading.value = true;
requireSmartLinksNativeBridge();
final payload = await SmartLinksNativeApi.getComments(
postId: postId,
authToken: token,
);
if (payload != null) {
comments.value = CommentsResponse.fromJson(payload);
} else {
Get.snackbar('Error', CommunityMessages.commentLoadFailed);
}
} catch (e) {
Get.snackbar(
'Error',
'${CommunityMessages.commentLoadFailed}: ${e.toString()}',
);
} finally {
isLoading.value = false;
}
}