[actions, reducers] action, type, reducer 추가

Detail Notes :

1. GET_BRAND_CATEGORY_PRODUCT_INFO (getBrandCategoryProductInfo) 추가
This commit is contained in:
younghoon100.park
2024-04-29 10:17:52 +09:00
parent fe156f937c
commit 77ddbed4bd
3 changed files with 65 additions and 9 deletions

View File

@@ -58,6 +58,7 @@ export const types = {
GET_BRAND_RECOMMENDED_SHOW_INFO: "GET_BRAND_RECOMMENDED_SHOW_INFO",
GET_BRAND_SERIES_INFO: "GET_BRAND_SERIES_INFO",
GET_BRAND_CATEGORY_INFO: "GET_BRAND_CATEGORY_INFO",
GET_BRAND_CATEGORY_PRODUCT_INFO: "GET_BRAND_CATEGORY_PRODUCT_INFO",
GET_BRAND_BEST_SELLER: "GET_BRAND_BEST_SELLER",
GET_BRAND_CREATORS_INFO: "GET_BRAND_CREATORS_INFO",
GET_BRAND_SHOWROOM: "GET_BRAND_SHOWROOM",

View File

@@ -214,7 +214,7 @@ export const getBrandRecommendedShowInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.log("getBrandRecommendedShowInfo onFail", error);
console.error("getBrandRecommendedShowInfo onFail", error);
};
TAxios(
@@ -313,16 +313,16 @@ export const getBrandSeriesInfo = (props) => (dispatch, getState) => {
export const getBrandCategoryInfo = (props) => (dispatch, getState) => {
const { catCdLv1, catCdLv2, patnrId } = props;
dispatch({
type: types.GET_BRAND_CATEGORY_INFO,
payload: {
...getState().brand.brandCategoryInfoData,
status: "pending",
},
});
// dispatch({
// type: types.GET_BRAND_CATEGORY_INFO,
// payload: {
// ...getState().brand.brandCategoryInfoData,
// status: "pending",
// },
// });
const onSuccess = (response) => {
// console.log("pyh getBrandCategoryInfo onSuccess ", response.data);
// console.log("getBrandCategoryInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_CATEGORY_INFO,
@@ -349,6 +349,45 @@ export const getBrandCategoryInfo = (props) => (dispatch, getState) => {
);
};
export const getBrandCategoryProductInfo = (props) => (dispatch, getState) => {
const { catCdLv1, catCdLv2, patnrId } = props;
// dispatch({
// type: "GET_BRAND_CATEGORY_PRODUCT_INFO",
// payload: {
// ...getState().brand.brandCategoryInfoData,
// status: "pending",
// },
// });
const onSuccess = (response) => {
// console.log("getBrandCategoryProductInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_CATEGORY_PRODUCT_INFO,
payload: {
data: response.data.data,
status: "fulfilled",
},
});
};
const onFail = (error) => {
console.error("getBrandCategoryProductInfo onFail ", error);
};
TAxios(
dispatch,
getState,
"get",
URLS.GET_BRAND_CATEGORY_INFO,
{ catCdLv1, catCdLv2, patnrId },
{},
onSuccess,
onFail
);
};
// Featured Brand Best Seller 상품 목록 조회 IF-LGSP-312
export const getBrandBestSeller = (props) => (dispatch, getState) => {
const { patnrId } = props;

View File

@@ -140,6 +140,22 @@ export const brandReducer = (state = initialState, action) => {
};
}
case types.GET_BRAND_CATEGORY_PRODUCT_INFO: {
const brandCategoryProductInfo =
action.payload && action.payload.data.brandCategoryProductInfo;
return {
...state,
brandCategoryInfoData: {
...state.brandCategoryInfoData,
data: {
...state.brandCategoryInfoData.data,
brandCategoryProductInfo,
},
},
};
}
case types.GET_BRAND_BEST_SELLER:
return {
...state,