uploadComment method

Future<Response> uploadComment({
  1. required int? userId,
  2. required int? postId,
  3. required String comment,
})

Implementation

Future<http.Response> uploadComment({
  required int? userId,
  required int? postId,
  required String comment,
}) {
  var data = json.encode({
    "user": userId,
    "post": postId,
    "comment": comment,
  });
  log(data);

  return post(Uri.parse('$apiURL/post-comments/create'),
      headers: {
        "token":
            "cnejwi8c9wehnd8fchni2x239jxexnjx2n23i8xn3oifr0cwd32fjnrf453vreve",
        "content-type": 'application/json',
      },
      body: data);
}