[actions, reducer, api] brand showroom 관련 로직 추가

Detail Notes :
This commit is contained in:
younghoon100.park
2024-04-01 15:19:15 +09:00
parent 647c359999
commit 2867059f08
4 changed files with 73 additions and 20 deletions

View File

@@ -55,6 +55,7 @@ export const types = {
GET_BRAND_CATEGORY_INFO: "GET_BRAND_CATEGORY_INFO",
GET_BRAND_BEST_SELLER: "GET_BRAND_BEST_SELLER",
GET_BRAND_CREATORS_INFO: "GET_BRAND_CREATORS_INFO",
GET_BRAND_SHOWROOM: "GET_BRAND_SHOWROOM",
// main actions
GET_SUB_CATEGORY: "GET_SUB_CATEGORY",

View File

@@ -13,7 +13,7 @@ export const getBrandList = () => (dispatch, getState) => {
});
const onSuccess = (response) => {
console.log("@@ getBrandList onSuccess ", response.data);
console.log("pyh getBrandList onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_LIST,
@@ -25,7 +25,7 @@ export const getBrandList = () => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("@@ getBrandList onFail", error);
console.error("pyh getBrandList onFail", error);
};
TAxios(
@@ -53,7 +53,7 @@ export const getBrandLayoutInfo = (props) => (dispatch, getState) => {
});
const onSuccess = (response) => {
console.log("@@ getBrandLayoutInfo onSuccess ", response.data);
console.log("pyh getBrandLayoutInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_LAYOUT_INFO,
@@ -65,7 +65,7 @@ export const getBrandLayoutInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("@@ getBrandLayoutInfo onFail ", error);
console.error("pyh getBrandLayoutInfo onFail ", error);
};
TAxios(
@@ -95,7 +95,7 @@ export const getBrandLiveChannelInfo = (props) => (dispatch, getState) => {
}
const onSuccess = (response) => {
console.log("@@ getBrandLiveChannelInfo onSuccess ", response.data);
console.log("pyh getBrandLiveChannelInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_LIVE_CHANNEL_INFO,
payload: {
@@ -106,7 +106,7 @@ export const getBrandLiveChannelInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("@@ getBrandLiveChannelInfo onFail ", error);
console.error("pyh getBrandLiveChannelInfo onFail ", error);
};
TAxios(
@@ -134,7 +134,7 @@ export const getBrandTSVInfo = (props) => (dispatch, getState) => {
});
const onSuccess = (response) => {
console.log("@@ getBrandTSVInfo onSuccess ", response.data);
console.log("pyh getBrandTSVInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_TSV_INFO,
@@ -146,7 +146,7 @@ export const getBrandTSVInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("@@ getBrandTSVInfo onFail ", error);
console.error("pyh getBrandTSVInfo onFail ", error);
};
TAxios(
@@ -174,7 +174,7 @@ export const getBrandRecommendedShowInfo = (props) => (dispatch, getState) => {
});
const onSuccess = (response) => {
console.log("@@ getBrandRecommendedShowInfo onSuccess", response.data);
console.log("pyh getBrandRecommendedShowInfo onSuccess", response.data);
dispatch({
type: types.GET_BRAND_RECOMMENDED_SHOW_INFO,
@@ -186,7 +186,7 @@ export const getBrandRecommendedShowInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.log("@@ getBrandRecommendedShowInfo onFail", error);
console.log("pyh getBrandRecommendedShowInfo onFail", error);
};
TAxios(
@@ -214,7 +214,7 @@ export const getBrandCreatorsInfo = (props) => (dispatch, getState) => {
});
const onSuccess = (response) => {
console.log("@@ getBrandCreatorsInfo onSuccess ", response.data);
console.log("pyh getBrandCreatorsInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_CREATORS_INFO,
@@ -226,7 +226,7 @@ export const getBrandCreatorsInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("@@ getBrandCreatorsInfo onFail ", error);
console.error("pyh getBrandCreatorsInfo onFail ", error);
};
TAxios(
@@ -254,7 +254,7 @@ export const getBrandSeriesInfo = (props) => (dispatch, getState) => {
});
const onSuccess = (response) => {
console.log("@@ getBrandSeriesInfo onSuccess ", response.data);
console.log("pyh getBrandSeriesInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_SERIES_INFO,
@@ -266,7 +266,7 @@ export const getBrandSeriesInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("@@ getBrandSeriesInfo onFail ", error);
console.error("pyh getBrandSeriesInfo onFail ", error);
};
TAxios(
@@ -294,7 +294,7 @@ export const getBrandCategoryInfo = (props) => (dispatch, getState) => {
});
const onSuccess = (response) => {
console.log("@@ getBrandCategoryInfo onSuccess ", response.data);
console.log("pyh getBrandCategoryInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_CATEGORY_INFO,
@@ -306,7 +306,7 @@ export const getBrandCategoryInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("@@ getBrandCategoryInfo onFail ", error);
console.error("pyh getBrandCategoryInfo onFail ", error);
};
TAxios(
@@ -334,7 +334,7 @@ export const getBrandBestSeller = (props) => (dispatch, getState) => {
});
const onSuccess = (response) => {
console.log("@@ getBrandBestSeller onSuccess ", response.data);
console.log("pyh getBrandBestSeller onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_BEST_SELLER,
@@ -346,7 +346,7 @@ export const getBrandBestSeller = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("@@ getBrandBestSeller onFail ", error);
console.error("pyh getBrandBestSeller onFail ", error);
};
TAxios(
@@ -360,3 +360,43 @@ export const getBrandBestSeller = (props) => (dispatch, getState) => {
onFail
);
};
// Featured Brands Showroom 조회 IF-LGSP-371
export const getBrandShowroom = (props) => (dispatch, getState) => {
const { patnrId } = props;
dispatch({
type: types.GET_BRAND_SHOWROOM,
payload: {
...getState().brand.brandShowroomData,
status: "pending",
},
});
const onSuccess = (response) => {
console.log("pyh getBrandShowroom onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_SHOWROOM,
payload: {
data: response.data.data,
status: "fulfilled",
},
});
};
const onFail = (error) => {
console.error("pyh getBrandShowroom onFail ", error);
};
TAxios(
dispatch,
getState,
"get",
URLS.GET_BRAND_SHOWROOM,
{ patnrId },
{},
onSuccess,
onFail
);
};

View File

@@ -39,6 +39,7 @@ export const URLS = {
GET_BRAND_CATEGORY_INFO: "/lgsp/v1/brand/category.lge",
GET_BRAND_BEST_SELLER: "/lgsp/v1/brand/bestSeller.lge",
GET_BRAND_CREATORS_INFO: "/lgsp/v1/brand/creators.lge",
GET_BRAND_SHOWROOM: "/lgsp/v1/brand/showroom.lge",
//on-sale controller
GET_ON_SALE_INFO: "/lgsp/v1/onsale/onsale.lge",

View File

@@ -1,7 +1,7 @@
import { types } from "../actions/actionTypes";
const initialState = {
// @@pyh Todo, @@test, temporary state, deleted later
// pyh Todo, test, temporary state, deleted later
upcomingAlamUseFlagData: {
upcomingAlamUseFlag: "N",
},
@@ -50,11 +50,16 @@ const initialState = {
data: {},
status: "idle",
},
brandShowroomData: {
data: {},
status: "idle",
},
};
export const brandReducer = (state = initialState, action) => {
switch (action.type) {
// @@pyh Todo, @@test, temporary case, deleted later
// pyh Todo, test, temporary case, deleted later
case "SET_MY_UPCOMING_USE_ALERT":
return {
...state,
@@ -137,6 +142,12 @@ export const brandReducer = (state = initialState, action) => {
brandBestSellerData: action.payload,
};
case types.GET_BRAND_SHOWROOM:
return {
...state,
brandShowroomData: action.payload,
};
default:
return state;
}