[FeaturedBrandsPanel] section Upcoming, API response에 따른 action type & function 추가

Detail Notes :

1. Upcoming action 추가
This commit is contained in:
younghoon100.park
2024-04-19 14:55:09 +09:00
parent 5f27fdb58c
commit 18b7612c43
5 changed files with 75 additions and 53 deletions

View File

@@ -45,6 +45,7 @@ export const types = {
GET_THEME_CURATION_INFO: "GET_THEME_CURATION_INFO",
GET_THEME_CURATION_DETAIL_INFO: "GET_THEME_CURATION_DETAIL_INFO",
GET_THEME_HOTEL_DETAIL_INFO: "GET_THEME_HOTEL_DETAIL_INFO",
GET_THEME_MENU_SHELF_INFO: "GET_THEME_MENU_SHELF_INFO",
UPDATE_SPOTLIGHTID: "UPDATE_SPOTLIGHTID",
// brand actions
@@ -58,7 +59,7 @@ export const types = {
GET_BRAND_BEST_SELLER: "GET_BRAND_BEST_SELLER",
GET_BRAND_CREATORS_INFO: "GET_BRAND_CREATORS_INFO",
GET_BRAND_SHOWROOM: "GET_BRAND_SHOWROOM",
GET_THEME_MENU_SHELF_INFO: "GET_THEME_MENU_SHELF_INFO",
SET_BRAND_LIVE_CHANNEL_UPCOMING: "SET_BRAND_LIVE_CHANNEL_UPCOMING",
// main actions
GET_SUB_CATEGORY: "GET_SUB_CATEGORY",

View File

@@ -7,13 +7,13 @@ export const getBrandList = () => (dispatch, getState) => {
dispatch({
type: types.GET_BRAND_LIST,
payload: {
data: getState().brand.brandInfoData.data,
...getState().brand.brandInfoData,
status: "pending",
},
});
const onSuccess = (response) => {
console.log("pyh getBrandList onSuccess ", response.data);
// console.log("getBrandList onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_LIST,
@@ -25,7 +25,7 @@ export const getBrandList = () => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("pyh getBrandList onFail", error);
console.error("getBrandList onFail", error);
};
TAxios(
@@ -47,13 +47,13 @@ export const getBrandLayoutInfo = (props) => (dispatch, getState) => {
dispatch({
type: types.GET_BRAND_LAYOUT_INFO,
payload: {
data: getState().brand.brandLayoutInfoData.data,
...getState().brand.brandLayoutInfoData,
status: "pending",
},
});
const onSuccess = (response) => {
console.log("pyh getBrandLayoutInfo onSuccess ", response.data);
// console.log("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("pyh getBrandLayoutInfo onFail ", error);
console.error("getBrandLayoutInfo onFail ", error);
};
TAxios(
@@ -82,20 +82,18 @@ export const getBrandLayoutInfo = (props) => (dispatch, getState) => {
// Featured Brands Live 채널 정보 조회 IF-LGSP-306
export const getBrandLiveChannelInfo = (props) => (dispatch, getState) => {
const { patnrId, upcoming } = props;
const { patnrId } = props;
if (upcoming === undefined) {
dispatch({
type: types.GET_BRAND_LIVE_CHANNEL_INFO,
payload: {
data: getState().brand.brandLiveChannelInfoData.data,
status: "pending",
},
});
}
dispatch({
type: types.GET_BRAND_LIVE_CHANNEL_INFO,
payload: {
...getState().brand.brandLiveChannelInfoData,
status: "pending",
},
});
const onSuccess = (response) => {
console.log("pyh getBrandLiveChannelInfo onSuccess ", response.data);
// console.log("getBrandLiveChannelInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_LIVE_CHANNEL_INFO,
payload: {
@@ -106,7 +104,7 @@ export const getBrandLiveChannelInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("pyh getBrandLiveChannelInfo onFail ", error);
console.error("getBrandLiveChannelInfo onFail ", error);
};
TAxios(
@@ -128,13 +126,13 @@ export const getBrandTSVInfo = (props) => (dispatch, getState) => {
dispatch({
type: types.GET_BRAND_TSV_INFO,
payload: {
data: getState().brand.brandTsvInfoData.data,
...getState().brand.brandTsvInfoData,
status: "pending",
},
});
const onSuccess = (response) => {
console.log("pyh getBrandTSVInfo onSuccess ", response.data);
// console.log("getBrandTSVInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_TSV_INFO,
@@ -146,7 +144,7 @@ export const getBrandTSVInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("pyh getBrandTSVInfo onFail ", error);
console.error("getBrandTSVInfo onFail ", error);
};
TAxios(
@@ -168,13 +166,13 @@ export const getBrandRecommendedShowInfo = (props) => (dispatch, getState) => {
dispatch({
type: types.GET_BRAND_RECOMMENDED_SHOW_INFO,
payload: {
data: getState().brand.brandRecommendedShowInfoData.data,
...getState().brand.brandRecommendedShowInfoData,
status: "pending",
},
});
const onSuccess = (response) => {
console.log("pyh getBrandRecommendedShowInfo onSuccess", response.data);
// console.log("getBrandRecommendedShowInfo onSuccess", response.data);
dispatch({
type: types.GET_BRAND_RECOMMENDED_SHOW_INFO,
@@ -186,7 +184,7 @@ export const getBrandRecommendedShowInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.log("pyh getBrandRecommendedShowInfo onFail", error);
console.log("getBrandRecommendedShowInfo onFail", error);
};
TAxios(
@@ -208,13 +206,13 @@ export const getBrandCreatorsInfo = (props) => (dispatch, getState) => {
dispatch({
type: types.GET_BRAND_CREATORS_INFO,
payload: {
data: getState().brand.brandCreatorsInfoData.data,
...getState().brand.brandCreatorsInfoData,
status: "pending",
},
});
const onSuccess = (response) => {
console.log("pyh getBrandCreatorsInfo onSuccess ", response.data);
// console.log("getBrandCreatorsInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_CREATORS_INFO,
@@ -226,7 +224,7 @@ export const getBrandCreatorsInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("pyh getBrandCreatorsInfo onFail ", error);
console.error("getBrandCreatorsInfo onFail ", error);
};
TAxios(
@@ -248,13 +246,13 @@ export const getBrandSeriesInfo = (props) => (dispatch, getState) => {
dispatch({
type: types.GET_BRAND_SERIES_INFO,
payload: {
data: getState().brand.brandSeriesInfoData.data,
...getState().brand.brandSeriesInfoData,
status: "pending",
},
});
const onSuccess = (response) => {
console.log("pyh getBrandSeriesInfo onSuccess ", response.data);
// console.log("getBrandSeriesInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_SERIES_INFO,
@@ -266,7 +264,7 @@ export const getBrandSeriesInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("pyh getBrandSeriesInfo onFail ", error);
console.error("getBrandSeriesInfo onFail ", error);
};
TAxios(
@@ -288,13 +286,13 @@ export const getBrandCategoryInfo = (props) => (dispatch, getState) => {
dispatch({
type: types.GET_BRAND_CATEGORY_INFO,
payload: {
data: getState().brand.brandCategoryInfoData.data,
...getState().brand.brandCategoryInfoData,
status: "pending",
},
});
const onSuccess = (response) => {
console.log("pyh getBrandCategoryInfo onSuccess ", response.data);
// console.log("pyh getBrandCategoryInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_CATEGORY_INFO,
@@ -306,7 +304,7 @@ export const getBrandCategoryInfo = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("pyh getBrandCategoryInfo onFail ", error);
console.error("getBrandCategoryInfo onFail ", error);
};
TAxios(
@@ -328,13 +326,13 @@ export const getBrandBestSeller = (props) => (dispatch, getState) => {
dispatch({
type: types.GET_BRAND_BEST_SELLER,
payload: {
data: getState().brand.brandBestSellerData.data,
...getState().brand.brandBestSellerData,
status: "pending",
},
});
const onSuccess = (response) => {
console.log("pyh getBrandBestSeller onSuccess ", response.data);
// console.log("getBrandBestSeller onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_BEST_SELLER,
@@ -346,7 +344,7 @@ export const getBrandBestSeller = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("pyh getBrandBestSeller onFail ", error);
console.error("getBrandBestSeller onFail ", error);
};
TAxios(
@@ -374,7 +372,7 @@ export const getBrandShowroom = (props) => (dispatch, getState) => {
});
const onSuccess = (response) => {
console.log("pyh getBrandShowroom onSuccess ", response.data);
// console.log("getBrandShowroom onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_SHOWROOM,
@@ -386,7 +384,7 @@ export const getBrandShowroom = (props) => (dispatch, getState) => {
};
const onFail = (error) => {
console.error("pyh getBrandShowroom onFail ", error);
console.error("getBrandShowroom onFail ", error);
};
TAxios(
@@ -400,3 +398,30 @@ export const getBrandShowroom = (props) => (dispatch, getState) => {
onFail
);
};
export const setBrandLiveChannelUpcoming = (props) => (dispatch, getState) => {
const { showId, strtDt } = props;
const storedBrandLiveChannelUpcoming =
getState().brand.brandLiveChannelInfoData.data.brandLiveChannelUpcoming;
const brandLiveChannelUpcoming = storedBrandLiveChannelUpcoming //
.map((item) => {
if (item.showId === showId && item.strtDt === strtDt) {
item.alamDispFlag = item.alamDispFlag === "Y" ? "N" : "Y";
}
return item;
});
dispatch({
type: types.SET_BRAND_LIVE_CHANNEL_UPCOMING,
payload: {
...getState().brand.brandLiveChannelInfoData,
data: {
...getState().brand.brandLiveChannelInfoData.data,
brandLiveChannelUpcoming,
},
},
});
};

View File

@@ -136,6 +136,12 @@ export const brandReducer = (state = initialState, action) => {
brandShowroomData: action.payload,
};
case types.SET_BRAND_LIVE_CHANNEL_UPCOMING:
return {
...state,
brandLiveChannelInfoData: action.payload,
};
default:
return state;
}

View File

@@ -5,7 +5,7 @@ import { useDispatch, useSelector } from "react-redux";
import IcUpcomingsNormal from "../../../../../../assets/images/badge/ic-upcomings-nor@3x.png";
import IcUpcomingsReserved from "../../../../../../assets/images/badge/ic-upcomings-sel@3x.png";
import { getBrandLiveChannelInfo } from "../../../../../actions/brandActions";
import { setBrandLiveChannelUpcoming } from "../../../../../actions/brandActions";
import { setShowPopup } from "../../../../../actions/commonActions";
import { setMainLiveUpcomingAlarm } from "../../../../../actions/mainActions";
import TButton from "../../../../../components/TButton/TButton";
@@ -69,12 +69,7 @@ export default memo(function NoLiveCard({ brandChanInfoItem, scrollTopBody }) {
})
);
dispatch(
getBrandLiveChannelInfo({
patnrId,
upcoming: true,
})
);
dispatch(setBrandLiveChannelUpcoming({ showId, strtDt }));
}, [
alamDispFlag,
dispatch,

View File

@@ -4,7 +4,7 @@ import { useDispatch, useSelector } from "react-redux";
import { setContainerLastFocusedElement } from "@enact/spotlight/src/container";
import { getBrandLiveChannelInfo } from "../../../../actions/brandActions";
import { setBrandLiveChannelUpcoming } from "../../../../actions/brandActions";
import { setShowPopup } from "../../../../actions/commonActions";
import { setMainLiveUpcomingAlarm } from "../../../../actions/mainActions";
import TVirtualGridList from "../../../../components/TVirtualGridList/TVirtualGridList";
@@ -63,12 +63,7 @@ export default memo(function UpComingList({
})
);
dispatch(
getBrandLiveChannelInfo({
patnrId,
upcoming: true,
})
);
dispatch(setBrandLiveChannelUpcoming({ showId, strtDt }));
};
const handleFocus = () => {