actionCatById.js 779 B

12345678910111213141516171819202122232425
  1. import { gql } from "../helpers";
  2. import { actionPromise } from "../reducers";
  3. export const actionCatById = ({ _id, promiseName = "catById", orderBy = "", limit = 20, skip = 0 } = {}) =>
  4. actionPromise(
  5. promiseName,
  6. gql(
  7. `query CatById($q:String){
  8. CategoryFindOne(query: $q){
  9. _id name
  10. parent{
  11. _id, name
  12. }
  13. subcategories{
  14. _id name
  15. }
  16. goods{
  17. _id name price amount
  18. }
  19. }
  20. }`,
  21. { q: JSON.stringify([{ _id }, { limit: !!limit ? limit : 5, skip, goods_order: orderBy }]) }
  22. )
  23. );