[워닝제거] cartReducer 공백제거.
- 공백만 제거.
This commit is contained in:
@@ -23,7 +23,7 @@ const initialState = {
|
||||
* Cart Reducer
|
||||
* 장바구니 관련 상태를 관리합니다.
|
||||
*/
|
||||
export const cartReducer = (state = initialState, action) => {
|
||||
export const cartReducer = (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
// 장바구니 조회 - API에서 가져온 전체 목록
|
||||
case types.GET_MY_INFO_CART_SEARCH:
|
||||
@@ -37,9 +37,9 @@ export const cartReducer = (state = initialState, action) => {
|
||||
};
|
||||
|
||||
// 장바구니에 상품 추가
|
||||
case types.INSERT_MY_INFO_CART:
|
||||
case types.INSERT_MY_INFO_CART:
|
||||
return {
|
||||
...state,
|
||||
...state,
|
||||
selectCart: {
|
||||
...state.selectCart,
|
||||
cartList: [...state.selectCart.cartList, action.payload],
|
||||
@@ -51,22 +51,22 @@ export const cartReducer = (state = initialState, action) => {
|
||||
case types.TOGGLE_CHECK_CART: {
|
||||
const checkedItem = action.payload.item;
|
||||
const isChecked = action.payload.isChecked;
|
||||
|
||||
|
||||
let updatedCheckedList = state.selectCart?.checkedItems || [];
|
||||
|
||||
if (isChecked) {
|
||||
|
||||
if (isChecked) {
|
||||
const itemExists = updatedCheckedList.some(
|
||||
item => item.prodSno === checkedItem.prodSno
|
||||
);
|
||||
if (!itemExists) {
|
||||
updatedCheckedList = [...updatedCheckedList, checkedItem];
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
updatedCheckedList = updatedCheckedList.filter(
|
||||
item => item.prodSno !== checkedItem.prodSno
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
...state,
|
||||
selectCart: {
|
||||
@@ -78,7 +78,7 @@ export const cartReducer = (state = initialState, action) => {
|
||||
}
|
||||
|
||||
// 장바구니에서 상품 삭제
|
||||
case types.DELETE_MY_INFO_CART:
|
||||
case types.DELETE_MY_INFO_CART:
|
||||
return {
|
||||
...state,
|
||||
getMyinfoCartSearch: {
|
||||
@@ -96,7 +96,7 @@ export const cartReducer = (state = initialState, action) => {
|
||||
getMyinfoCartSearch: {
|
||||
...state.getMyinfoCartSearch,
|
||||
cartList: (state.getMyinfoCartSearch.cartList || []).map(item =>
|
||||
item.prodSno === action.payload.prodSno
|
||||
item.prodSno === action.payload.prodSno
|
||||
? { ...item, ...action.payload }
|
||||
: item
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user