[actions, reducers] onSale 관련 logic 추가

Detail Notes :

1. action type 추가 (COPY_CATEGORY_INFO)
2. reducer 수정 (copiedCategoryInfos)
This commit is contained in:
younghoon100.park
2024-04-08 09:49:27 +09:00
parent 16289f1d72
commit 32d60ea10f
3 changed files with 14 additions and 0 deletions

View File

@@ -88,6 +88,7 @@ export const types = {
// onSale actions
GET_ON_SALE_INFO: "GET_ON_SALE_INFO",
COPY_CATEGORY_INFO: "COPY_CATEGORY_INFO",
// product actions
GET_BEST_SELLER: "GET_BEST_SELLER",

View File

@@ -42,3 +42,8 @@ export const getOnSaleInfo = (props) => (dispatch, getState) => {
onFail
);
};
export const copyCategoryInfos = (categoryInfos) => ({
type: types.COPY_CATEGORY_INFO,
payload: categoryInfos,
});

View File

@@ -5,6 +5,8 @@ const initialState = {
data: {},
status: "idle",
},
copiedCategoryInfos: [],
};
export const onSaleReducer = (state = initialState, action) => {
@@ -15,6 +17,12 @@ export const onSaleReducer = (state = initialState, action) => {
onSaleData: action.payload,
};
case types.COPY_CATEGORY_INFO:
return {
...state,
copiedCategoryInfos: action.payload,
};
default:
return state;
}