import { gql, actionPromise } from "./index";



export const gqlAddLike = (postId) =>
  actionPromise(
    "addLike",
    gql(
      `mutation AddLike($like:LikeInput){
          LikeUpsert(like:$like)
          {
            _id
          }
        }`,
      {
        like: {
          post: {
            _id: postId,
          },
        },
      }
    )
  );



export const gqlDeleteLike = (likeId, postId) =>
  actionPromise(
    "deletePromise",
    gql(
      `mutation DeleteLike($like:LikeInput){
          LikeDelete(like: $like)
          {
            _id
          }
        }`,
      {
        like: {
          _id: likeId,
          post: {
            _id: postId,
          },
        },
      }
    )
  );
