actionCatsFind.js 871 B

12345678910111213141516171819202122232425262728
  1. import { gql } from "../helpers";
  2. import { actionPromise } from "../reducers";
  3. export const actionCatsFind = ({ text = "", limit = 7, skip = 0, promiseName = "catsFind", orderBy = "_id" }) =>
  4. actionPromise(
  5. promiseName,
  6. gql(
  7. `query CatsFind($query:String){
  8. CategoryFind(query: $query){
  9. _id name
  10. parent{
  11. _id name
  12. }
  13. }
  14. }`,
  15. {
  16. query: JSON.stringify([
  17. { name__contains: text, _id__contains: text },
  18. {
  19. limit: !!limit ? limit : 5,
  20. skip,
  21. orderBy,
  22. },
  23. ]),
  24. }
  25. )
  26. );