exploreQuery.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { gql } from '../../helpers/getGQL'
  2. import { actionPromise } from '../types/promiseTypes'
  3. export const actionExplorePosts = (skip) =>
  4. actionPromise(
  5. 'explorePosts',
  6. gql(
  7. ` query PostsFeed($_id:String){
  8. PostFind(query:$_id){
  9. owner{_id login avatar{url}}
  10. images{_id url originalFileName} title text
  11. _id likesCount
  12. likes{
  13. _id
  14. owner{
  15. _id login avatar {_id url}
  16. }
  17. }
  18. comments{
  19. _id, createdAt, text owner{_id login avatar{_id url}}
  20. answers{
  21. _id, createdAt, text owner{_id login avatar{_id url}}
  22. }
  23. }
  24. }
  25. }`,
  26. {
  27. _id: JSON.stringify([
  28. {},
  29. {
  30. sort: [{ _id: -1 }],
  31. skip: [skip || 0],
  32. limit: [12],
  33. },
  34. ]),
  35. },
  36. ),
  37. )
  38. export const actionExplorePostsCount = () =>
  39. actionPromise(
  40. 'explorePostsCount',
  41. gql(
  42. ` query CountAllPosts($_id:String!){
  43. PostCount(query:$_id)
  44. }`,
  45. {
  46. _id: JSON.stringify([{}]),
  47. },
  48. ),
  49. )