From e39e8230d03446a6035196e9a726d3c941a36c98 Mon Sep 17 00:00:00 2001 From: "junghoon86.park" Date: Mon, 29 Jan 2024 13:41:24 +0900 Subject: [PATCH] =?UTF-8?q?[mainSlice]=20=ED=99=88=ED=99=94=EB=A9=B4=20pop?= =?UTF-8?q?ular=20show=20=EC=97=B0=EA=B2=B0=EC=9D=84=20=EC=9C=84=ED=95=9C?= =?UTF-8?q?=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- com.twin.app.shoptime/src/App/App.js | 9 +++-- com.twin.app.shoptime/src/api/apiConfig.js | 1 + .../src/features/main/mainSlice.js | 34 ++++++++++++++++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/com.twin.app.shoptime/src/App/App.js b/com.twin.app.shoptime/src/App/App.js index e86033bc..20934604 100644 --- a/com.twin.app.shoptime/src/App/App.js +++ b/com.twin.app.shoptime/src/App/App.js @@ -6,10 +6,14 @@ import ThemeDecorator from "@enact/sandstone/ThemeDecorator"; import { getBrandList } from "../features/brand/brandsSlice"; import { getAuthenticationCode } from "../features/device/deviceSlice"; -import { getHomeMenu, getHomeLayout, getHomeMainContents } from "../features/home/homeSlice"; +import { + getHomeMenu, + getHomeLayout, + getHomeMainContents, +} from "../features/home/homeSlice"; import { getMyRecommandedKeyword } from "../features/mypage/myPageSlice"; import { getOnSaleInfo } from "../features/onSale/onSaleSlice"; -import { getSubCategory } from "../features/main/mainSlice"; +import { getSubCategory, getTop20Show } from "../features/main/mainSlice"; import { getBestSeller } from "../features/product/productSlice"; import MainView from "../views/MainView/MainView"; import css from "./App.module.less"; @@ -35,6 +39,7 @@ function AppBase(props) { filterType: "", }) ); + dispatch(getTop20Show()); }, [dispatch]); return ; diff --git a/com.twin.app.shoptime/src/api/apiConfig.js b/com.twin.app.shoptime/src/api/apiConfig.js index 1cd2696d..c61b2a72 100644 --- a/com.twin.app.shoptime/src/api/apiConfig.js +++ b/com.twin.app.shoptime/src/api/apiConfig.js @@ -41,6 +41,7 @@ export const URLS = { //main controller GET_SUB_CATEGORY: "/lgsp/v1/main/subcategory.lge", + GET_TOP20_SHOW: "/lgsp/v1/main/top/show.lge", }; export const getUrl = (endStr) => { diff --git a/com.twin.app.shoptime/src/features/main/mainSlice.js b/com.twin.app.shoptime/src/features/main/mainSlice.js index fc43af1e..8e151450 100644 --- a/com.twin.app.shoptime/src/features/main/mainSlice.js +++ b/com.twin.app.shoptime/src/features/main/mainSlice.js @@ -35,6 +35,35 @@ export const getSubCategory = createAsyncThunk( } ); +//메인화면 Live Show 정보 조회 +export const getTop20Show = createAsyncThunk( + "main/getTop20Show", + + async (_, thunkAPI) => { + const onSuccess = (response) => { + console.log("getTop20Show onSuccess ", response.data); + + thunkAPI.dispatch( + mainSlice.actions.updateSubCategoryData(response.data.data) + ); + }; + const onFail = (error) => { + console.log("getTop20Show onFail", error); + }; + + TAxios( + thunkAPI.dispatch, + thunkAPI.getState, + "get", + URLS.GET_TOP20_SHOW, + {}, + {}, + onSuccess, + onFail + ); + } +); + const initialState = { subCategoryData: {}, }; @@ -46,9 +75,12 @@ export const mainSlice = createSlice({ updateSubCategoryData: (state, action) => { state.subCategoryData = action.payload; }, + updateTop20Show: (state, action) => { + state.top20ShowData = action.payload; + }, }, }); -export const { updateSubCategoryData } = mainSlice.actions; +export const { updateSubCategoryData, updateTop20Show } = mainSlice.actions; export default mainSlice.reducer;