vote method

Future vote(
  1. dynamic postOrComment,
  2. String choice
)

Implementation

Future<dynamic> vote(dynamic postOrComment, String choice) async {
  // String route;
  // if ("${postOrComment.parentIdx}".toInt > 0) {
  //   route = 'comment.vote';
  // } else {
  //   route = 'post.vote';
  // }
  final re = await request({'route': 'post.vote', 'idx': postOrComment.idx, 'choice': choice});
  if ("${postOrComment.parentIdx}".toInt > 0) {
    return ApiComment.fromJson(re);
  } else {
    return ApiPost.fromJson(re);
  }
}