[actions, reducers] network 상태 관리 추가에 따른 수정
Detail Notes :
This commit is contained in:
@@ -4,12 +4,23 @@ import { types } from "./actionTypes";
|
||||
|
||||
// Featured Brands 정보 조회 IF-LGSP-304
|
||||
export const getBrandList = () => (dispatch, getState) => {
|
||||
dispatch({
|
||||
type: types.GET_BRAND_LIST,
|
||||
payload: {
|
||||
data: getState().brand.brandInfoData.data,
|
||||
status: "pending",
|
||||
},
|
||||
});
|
||||
|
||||
const onSuccess = (response) => {
|
||||
console.log("@@ getBrandList onSuccess ", response.data);
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_LIST,
|
||||
payload: response.data.data,
|
||||
payload: {
|
||||
data: response.data.data,
|
||||
status: "fulfilled",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -33,12 +44,23 @@ export const getBrandList = () => (dispatch, getState) => {
|
||||
export const getBrandLayoutInfo = (props) => (dispatch, getState) => {
|
||||
const { patnrId } = props;
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_LAYOUT_INFO,
|
||||
payload: {
|
||||
data: getState().brand.brandLayoutInfoData.data,
|
||||
status: "pending",
|
||||
},
|
||||
});
|
||||
|
||||
const onSuccess = (response) => {
|
||||
console.log("@@ getBrandLayoutInfo onSuccess ", response.data);
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_LAYOUT_INFO,
|
||||
payload: response.data.data,
|
||||
payload: {
|
||||
data: response.data.data,
|
||||
status: "fulfilled",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -62,12 +84,22 @@ export const getBrandLayoutInfo = (props) => (dispatch, getState) => {
|
||||
export const getBrandLiveChannelInfo = (props) => (dispatch, getState) => {
|
||||
const { patnrId } = props;
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_LIVE_CHANNEL_INFO,
|
||||
payload: {
|
||||
data: getState().brand.brandLiveChannelInfoData.data,
|
||||
status: "pending",
|
||||
},
|
||||
});
|
||||
|
||||
const onSuccess = (response) => {
|
||||
console.log("@@ getBrandLiveChannelInfo onSuccess ", response.data);
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_LIVE_CHANNEL_INFO,
|
||||
payload: response.data.data,
|
||||
payload: {
|
||||
data: response.data.data,
|
||||
status: "fulfilled",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -91,12 +123,23 @@ export const getBrandLiveChannelInfo = (props) => (dispatch, getState) => {
|
||||
export const getBrandTSVInfo = (props) => (dispatch, getState) => {
|
||||
const { patnrId } = props;
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_TSV_INFO,
|
||||
payload: {
|
||||
data: getState().brand.brandTsvInfoData.data,
|
||||
status: "pending",
|
||||
},
|
||||
});
|
||||
|
||||
const onSuccess = (response) => {
|
||||
console.log("@@ getBrandTSVInfo onSuccess ", response.data);
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_TSV_INFO,
|
||||
payload: response.data.data,
|
||||
payload: {
|
||||
data: response.data.data,
|
||||
status: "fulfilled",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -120,12 +163,23 @@ export const getBrandTSVInfo = (props) => (dispatch, getState) => {
|
||||
export const getBrandRecommendedShowInfo = (props) => (dispatch, getState) => {
|
||||
const { catCd, patnrId } = props;
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_RECOMMENDED_SHOW_INFO,
|
||||
payload: {
|
||||
data: getState().brand.brandRecommendedShowInfoData.data,
|
||||
status: "pending",
|
||||
},
|
||||
});
|
||||
|
||||
const onSuccess = (response) => {
|
||||
console.log("@@ getBrandRecommendedShowInfo onSuccess", response.data);
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_RECOMMENDED_SHOW_INFO,
|
||||
payload: response.data.data,
|
||||
payload: {
|
||||
data: response.data.data,
|
||||
status: "fulfilled",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -149,12 +203,23 @@ export const getBrandRecommendedShowInfo = (props) => (dispatch, getState) => {
|
||||
export const getBrandCreatorsInfo = (props) => (dispatch, getState) => {
|
||||
const { hstNm, patnrId } = props;
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_CREATORS_INFO,
|
||||
payload: {
|
||||
data: getState().brand.brandCreatorsInfoData.data,
|
||||
status: "pending",
|
||||
},
|
||||
});
|
||||
|
||||
const onSuccess = (response) => {
|
||||
console.log("@@ getBrandCreatorsInfo onSuccess ", response.data);
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_CREATORS_INFO,
|
||||
payload: response.data.data,
|
||||
payload: {
|
||||
data: response.data.data,
|
||||
status: "fulfilled",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -178,12 +243,23 @@ export const getBrandCreatorsInfo = (props) => (dispatch, getState) => {
|
||||
export const getBrandSeriesInfo = (props) => (dispatch, getState) => {
|
||||
const { patnrId, seriesId } = props;
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_SERIES_INFO,
|
||||
payload: {
|
||||
data: getState().brand.brandSeriesInfoData.data,
|
||||
status: "pending",
|
||||
},
|
||||
});
|
||||
|
||||
const onSuccess = (response) => {
|
||||
console.log("@@ getBrandSeriesInfo onSuccess ", response.data);
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_SERIES_INFO,
|
||||
payload: response.data.data,
|
||||
payload: {
|
||||
data: response.data.data,
|
||||
status: "fulfilled",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -207,12 +283,23 @@ 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: {
|
||||
data: getState().brand.brandCategoryInfoData.data,
|
||||
status: "pending",
|
||||
},
|
||||
});
|
||||
|
||||
const onSuccess = (response) => {
|
||||
console.log("@@ getBrandCategoryInfo onSuccess ", response.data);
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_CATEGORY_INFO,
|
||||
payload: response.data.data,
|
||||
payload: {
|
||||
data: response.data.data,
|
||||
status: "fulfilled",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -236,12 +323,23 @@ export const getBrandCategoryInfo = (props) => (dispatch, getState) => {
|
||||
export const getBrandBestSeller = (props) => (dispatch, getState) => {
|
||||
const { patnrId } = props;
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_BEST_SELLER,
|
||||
payload: {
|
||||
data: getState().brand.brandBestSellerData.data,
|
||||
status: "pending",
|
||||
},
|
||||
});
|
||||
|
||||
const onSuccess = (response) => {
|
||||
console.log("@@ getBrandBestSeller onSuccess ", response.data);
|
||||
|
||||
dispatch({
|
||||
type: types.GET_BRAND_BEST_SELLER,
|
||||
payload: response.data.data,
|
||||
payload: {
|
||||
data: response.data.data,
|
||||
status: "fulfilled",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,15 +1,50 @@
|
||||
import { types } from "../actions/actionTypes";
|
||||
|
||||
const initialState = {
|
||||
brandInfoData: {},
|
||||
brandLayoutInfoData: {},
|
||||
brandLiveChannelInfoData: {},
|
||||
brandTsvInfoData: {},
|
||||
brandRecommendedShowInfoData: {},
|
||||
brandCreatorsInfoData: {},
|
||||
brandSeriesInfoData: {},
|
||||
brandCategoryInfoData: {},
|
||||
brandBestSellerData: {},
|
||||
brandInfoData: {
|
||||
data: {},
|
||||
status: "idle",
|
||||
},
|
||||
|
||||
brandLayoutInfoData: {
|
||||
data: {},
|
||||
status: "idle",
|
||||
},
|
||||
|
||||
brandLiveChannelInfoData: {
|
||||
data: {},
|
||||
status: "idle",
|
||||
},
|
||||
|
||||
brandTsvInfoData: {
|
||||
data: {},
|
||||
status: "idle",
|
||||
},
|
||||
|
||||
brandRecommendedShowInfoData: {
|
||||
data: {},
|
||||
status: "idle",
|
||||
},
|
||||
|
||||
brandCreatorsInfoData: {
|
||||
data: {},
|
||||
status: "idle",
|
||||
},
|
||||
|
||||
brandSeriesInfoData: {
|
||||
data: {},
|
||||
status: "idle",
|
||||
},
|
||||
|
||||
brandCategoryInfoData: {
|
||||
data: {},
|
||||
status: "idle",
|
||||
},
|
||||
|
||||
brandBestSellerData: {
|
||||
data: {},
|
||||
status: "idle",
|
||||
},
|
||||
};
|
||||
|
||||
export const brandReducer = (state = initialState, action) => {
|
||||
@@ -41,14 +76,15 @@ export const brandReducer = (state = initialState, action) => {
|
||||
case types.GET_BRAND_RECOMMENDED_SHOW_INFO: {
|
||||
const brandRecommendedShowInfo =
|
||||
action.payload &&
|
||||
action.payload.brandRecommendedShowInfo //
|
||||
?.filter((_, index) => index < 10);
|
||||
action.payload.data.brandRecommendedShowInfo?.slice(0, 10);
|
||||
|
||||
const data = { ...action.payload.data, brandRecommendedShowInfo };
|
||||
|
||||
return {
|
||||
...state,
|
||||
brandRecommendedShowInfoData: {
|
||||
...action.payload,
|
||||
brandRecommendedShowInfo,
|
||||
data,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -56,14 +92,15 @@ export const brandReducer = (state = initialState, action) => {
|
||||
case types.GET_BRAND_CREATORS_INFO: {
|
||||
const barndCreatorsShowInfo =
|
||||
action.payload &&
|
||||
action.payload.barndCreatorsShowInfo //
|
||||
?.filter((_, index) => index < 10);
|
||||
action.payload.data.barndCreatorsShowInfo?.slice(0, 10);
|
||||
|
||||
const data = { ...action.payload.data, barndCreatorsShowInfo };
|
||||
|
||||
return {
|
||||
...state,
|
||||
brandCreatorsInfoData: {
|
||||
...action.payload,
|
||||
barndCreatorsShowInfo,
|
||||
data,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -92,50 +129,3 @@ export const brandReducer = (state = initialState, action) => {
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export const selectBrandInfo = (state) => state.brand.brandInfoData.brandInfo;
|
||||
|
||||
export const selectBrandLayoutInfo = (state) =>
|
||||
state.brand.brandLayoutInfoData.brandLayoutInfo;
|
||||
|
||||
export const selectBrandTopImgInfo = (state) =>
|
||||
state.brand.brandLayoutInfoData.brandTopImgInfo;
|
||||
|
||||
export const selectBrandChanInfo = (state) =>
|
||||
state.brand.brandLiveChannelInfoData.brandChanInfo;
|
||||
|
||||
export const selectBrandChannelCnt = (state) =>
|
||||
state.brand.brandLiveChannelInfoData.brandChannelCnt;
|
||||
|
||||
export const selectBrandLiveChannelUpcoming = (state) =>
|
||||
state.brand.brandLiveChannelInfoData.brandLiveChannelUpcoming;
|
||||
|
||||
export const selectBrandTsvInfo = (state) =>
|
||||
state.brand.brandTsvInfoData.brandTsvInfo;
|
||||
|
||||
export const selectBrandBestSellerInfo = (state) =>
|
||||
state.brand.brandBestSellerData.brandBestSellerInfo;
|
||||
|
||||
export const selectBrandRecommendedShowCategoryInfo = (state) =>
|
||||
state.brand.brandRecommendedShowInfoData.brandRecommendedShowCategoryInfo;
|
||||
|
||||
export const selectBrandRecommendedShowInfo = (state) =>
|
||||
state.brand.brandRecommendedShowInfoData.brandRecommendedShowInfo;
|
||||
|
||||
export const selectBrandCreatorsInfo = (state) =>
|
||||
state.brand.brandCreatorsInfoData.brandCreatorsInfo;
|
||||
|
||||
export const selectBarndCreatorsShowInfo = (state) =>
|
||||
state.brand.brandCreatorsInfoData.barndCreatorsShowInfo;
|
||||
|
||||
export const selectBrandSeriesGroupInfo = (state) =>
|
||||
state.brand.brandSeriesInfoData.brandSeriesGroupInfo;
|
||||
|
||||
export const selectBrandSeriesInfo = (state) =>
|
||||
state.brand.brandSeriesInfoData.brandSeriesInfo;
|
||||
|
||||
export const selectBrandCategoryInfo = (state) =>
|
||||
state.brand.brandCategoryInfoData.brandCategoryInfo;
|
||||
|
||||
export const selectBrandCategoryProductInfo = (state) =>
|
||||
state.brand.brandCategoryInfoData.brandCategoryProductInfo;
|
||||
|
||||
Reference in New Issue
Block a user