123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- import { gql } from "../../helpers/getGQL";
- import { actionPromise } from "../types/promiseTypes";
- export const actionAddLike = (postId) =>
- actionPromise(
- 'addLike',
- gql(
- `mutation AddLike($like:LikeInput){
- LikeUpsert(like:$like)
- {
- _id
- }
- }`,
- {
- like: {
- post: {
- _id: postId,
- },
- },
- },
- ),
- )
- export const actionDeleteLike = (likeId, postId) =>
- actionPromise(
- 'deleteLike',
- gql(
- `mutation DeleteLike($like:LikeInput){
- LikeDelete(like: $like)
- {
- _id
- }
- }`,
- {
- like: {
- _id: likeId,
- post: {
- _id: postId,
- },
- },
- },
- ),
- )
- export const actionFindLikes = (_id) =>
- actionPromise(
- 'onePostLikes',
- gql(
- `query OnePostLikes($post:String){
- PostFindOne(query:$post){
- likes{
- _id
- owner{
- _id login avatar {url}
- }
- }
- }
- }`,
- {
- post: JSON.stringify([{ _id }]),
- },
- ),
- )
- // export const actionGetFindLiked = (_id) =>
- // actionPromise(
- // 'findLiked',
- // gql(
- // ` query LikeFindPost($id:String!) {
- // LikeFind(query:$id){
- // owner { _id nick login
- // avatar{_id url}
- // }
- // }
- // } `,
- // {
- // id: JSON.stringify([{ 'post._id': _id }]),
- // },
- // ),
- // )
|