Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. let cc = '';
  2. data.allCarts[0].items.map(item => cc = cc.concat(`'${item.id}',`));
  3.  
  4. cc = cc.concat(`'${itemid}'`);
  5. console.log('mogg ', cc);
  6. cc = cc.replace(/'/g, '"');
  7. console.log('gogg ', cc);
  8.  
  9. let nodeid = data.allCarts[0].id;
  10. console.log('Node:: ', nodeid, 'items:: ', cc);
  11.  
  12. client.mutate(`{
  13. uo: updateCart(id: "${nodeid}", itemsIds: [${cc}]){
  14. id
  15. }
  16. }`
  17. ).then(
  18. (response) => {
  19. console.log('cart update:: ', response.uo);
  20. sendTextMessage(user, 'Done adding to cart, choose to add more');
  21. }
  22. )
  23. .catch(error => console.error(error));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement