From 16a09b2e2b8793bdd68875f4b0fd5c0ceb75e321 Mon Sep 17 00:00:00 2001 From: "junghoon86.park" Date: Fri, 12 Dec 2025 13:15:52 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=9B=8C=EB=8B=9D=EC=A0=9C=EA=B1=B0]=20cartRe?= =?UTF-8?q?ducer=20=EA=B3=B5=EB=B0=B1=EC=A0=9C=EA=B1=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 공백만 제거. --- .../src/reducers/cartReducer.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/com.twin.app.shoptime/src/reducers/cartReducer.js b/com.twin.app.shoptime/src/reducers/cartReducer.js index 8b7c97a1..358a1dcc 100644 --- a/com.twin.app.shoptime/src/reducers/cartReducer.js +++ b/com.twin.app.shoptime/src/reducers/cartReducer.js @@ -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 ),