Skip to content

Commit

Permalink
🔀 Merge #1965 into deploy/rinkeby
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Nov 27, 2024
2 parents ff4521a + 3286f76 commit c24de0c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/store/modules/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ const mutations = {
[TYPES.SHOPPING_CART_REPLACE_ALL_NFT_CLASS](state, map) {
state.shoppingCartNFTClassByIdMap = map;
},
[TYPES.SHOPPING_CART_ADD_BOOK_PRODUCT](state, newItem) {
[TYPES.SHOPPING_CART_ADD_BOOK_PRODUCT](
state,
{ item: newItem, overwrite = false }
) {
const {
collectionId,
classId,
Expand All @@ -58,7 +61,7 @@ const mutations = {
quantity: 1,
priceIndex: priceIndex ?? (classId ? 0 : undefined),
};
} else {
} else if (!overwrite) {
item = {
...item,
quantity: item.quantity + 1,
Expand Down Expand Up @@ -152,12 +155,12 @@ const actions = {
if (getters.shoppingCartBookProductList.length >= BATCH_COLLECT_MAX) {
return;
}
commit(TYPES.SHOPPING_CART_ADD_BOOK_PRODUCT, item);
commit(TYPES.SHOPPING_CART_ADD_BOOK_PRODUCT, { item });
dispatch('saveBookProductShoppingCart');
},
addBookProductsToShoppingCart({ commit, dispatch }, items) {
items.slice(0, BATCH_COLLECT_MAX).forEach(item => {
commit(TYPES.SHOPPING_CART_ADD_BOOK_PRODUCT, item);
commit(TYPES.SHOPPING_CART_ADD_BOOK_PRODUCT, { item, overwrite: true });
});
dispatch('saveBookProductShoppingCart');
},
Expand Down

0 comments on commit c24de0c

Please sign in to comment.