|
@@ -13,6 +13,7 @@ function cartReducer(state, { type, count, id, image, name, description, price
|
|
|
}
|
|
|
}
|
|
|
if (type === "CART_ADD") {
|
|
|
+ //debugger
|
|
|
state = {
|
|
|
...state,
|
|
|
|
|
@@ -22,7 +23,7 @@ function cartReducer(state, { type, count, id, image, name, description, price
|
|
|
description: description,
|
|
|
image: image,
|
|
|
name, name,
|
|
|
- count: (count + 1 )|| 0},
|
|
|
+ count: ((state[id] ? state[id].count : 0) + 1 )},
|
|
|
};
|
|
|
}
|
|
|
|
|
@@ -39,7 +40,7 @@ function cartReducer(state, { type, count, id, image, name, description, price
|
|
|
|
|
|
|
|
|
|
|
|
-const actionCartAdd = (name, price, id, description, image, count = 1) => ({
|
|
|
+const actionCartAdd = (name, price, id, description, image, count = 0) => ({
|
|
|
type: "CART_ADD",
|
|
|
id,
|
|
|
count,
|