actionChangeOneGood.js 665 B

123456789101112131415161718192021222324
  1. import { actionPromise, actionCatById } from ".";
  2. import gql from "../api";
  3. const actionChangeOneGood = (_id, _idCat, name, description, price, idImg) =>
  4. async (dispatch) => {
  5. await dispatch(actionPromise('changeGood', gql(`mutation changeGood($good:GoodInput){
  6. GoodUpsert(good:$good){
  7. _id name
  8. }
  9. }`, {
  10. "good":{
  11. "_id": _id,
  12. "description": description,
  13. "name": name,
  14. "price": +price,
  15. // "images": [{"_id": idImg}]
  16. "images": idImg,
  17. }
  18. })))
  19. dispatch(actionCatById(_idCat)); console.log('_idCattttttt', _idCat)
  20. }
  21. export default actionChangeOneGood;