Created
October 24, 2018 14:28
-
-
Save anotherxx/596ac8bd8afebc3fb47de429aa9b90e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[cartActions.INCREMENT_CART_ITEM_QTY]({ commit, state }, cartItemId) { | |
let clonedCartItems = {...state.cartItems} | |
clonedCartItems[cartItemId].qty++ | |
let actualCartItems = [] | |
for (let key in clonedCartItems) { | |
let currentCartItem = clonedCartItems[key] | |
actualCartItems.push({ | |
id: currentCartItem.id, | |
product_id: currentCartItem.product_id, | |
qty: currentCartItem.qty | |
}) | |
} | |
CartService.updateCartState(state.cartId, actualCartItems) | |
.then(data => { | |
let cartDetails = data.result | |
commit(cartMutations.SET_CART_DETAILS, cartDetails) | |
}) | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment