[장바구니] 노출관련 및 api에 맞춰 작업 #1
- 현재 추가는 안됌. - 삭제, 갯수 조절에 대해서는 정상작동. - 금액 노출 정상적이지 않는 부분에 대해서 수정
This commit is contained in:
@@ -40,31 +40,19 @@ export const cartReducer = (state = initialState, action) => {
|
||||
cartList: [...state.getMyinfoCartSearch.cartList, action.payload],
|
||||
totalCount: (state.getMyinfoCartSearch.totalCount || 0) + 1,
|
||||
},
|
||||
lastAction: {
|
||||
type: "insert",
|
||||
data: action.payload,
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
error: null,
|
||||
};
|
||||
|
||||
// 장바구니에서 상품 삭제
|
||||
case types.DELETE_MY_INFO_CART:
|
||||
case types.DELETE_MY_INFO_CART:
|
||||
return {
|
||||
...state,
|
||||
getMyinfoCartSearch: {
|
||||
...state.getMyinfoCartSearch,
|
||||
cartList: state.getMyinfoCartSearch.cartList.filter(
|
||||
cartList: (state.getMyinfoCartSearch.cartList || []).filter(
|
||||
item => item.prodSno !== action.payload.prodSno
|
||||
),
|
||||
totalCount: Math.max(0, (state.getMyinfoCartSearch.totalCount || 0) - 1),
|
||||
},
|
||||
lastAction: {
|
||||
type: "delete",
|
||||
data: action.payload,
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
error: null,
|
||||
};
|
||||
|
||||
case types.UPDATE_MY_INFO_CART:
|
||||
@@ -72,13 +60,12 @@ export const cartReducer = (state = initialState, action) => {
|
||||
...state,
|
||||
getMyinfoCartSearch: {
|
||||
...state.getMyinfoCartSearch,
|
||||
cartList: state.getMyinfoCartSearch.cartList.map(item =>
|
||||
cartList: (state.getMyinfoCartSearch.cartList || []).map(item =>
|
||||
item.prodSno === action.payload.prodSno
|
||||
? { ...item, ...action.payload }
|
||||
: item
|
||||
),
|
||||
},
|
||||
error: null,
|
||||
};
|
||||
|
||||
// 장바구니에 상품 추가 (addToCart - 로컬 상태용)
|
||||
|
||||
Reference in New Issue
Block a user