actionCategoryUpsert.js 798 B

123456789101112131415161718192021222324252627
  1. import { gql } from "../helpers";
  2. import { actionPromise } from "../reducers";
  3. export const actionCategoryUpsert = (category) => async (dispatch) => {
  4. dispatch(
  5. actionPromise(
  6. "categoryUpsert",
  7. gql(
  8. `mutation CatUpsert($category:CategoryInput!){
  9. CategoryUpsert(category:$category){
  10. _id name
  11. parent{
  12. _id, name
  13. }
  14. subcategories{
  15. _id name
  16. }
  17. goods{
  18. _id name price amount
  19. }
  20. }
  21. }`,
  22. { category }
  23. )
  24. )
  25. );
  26. };