diff --git a/com.twin.app.shoptime/src/App/App.js b/com.twin.app.shoptime/src/App/App.js index b999aa47..62d27233 100644 --- a/com.twin.app.shoptime/src/App/App.js +++ b/com.twin.app.shoptime/src/App/App.js @@ -1,13 +1,15 @@ -import ThemeDecorator from "@enact/sandstone/ThemeDecorator"; import React, { useEffect } from "react"; -import css from "./App.module.less"; -import MainView from "../views/MainView/MainView"; - import { useDispatch } from "react-redux"; + +import ThemeDecorator from "@enact/sandstone/ThemeDecorator"; + +import { getBrandList } from "../features/brand/featuredBrandsSlice"; import { getAuthenticationCode } from "../features/device/deviceSlice"; import { getHomeMenu } from "../features/home/homeSlice"; import { getOnSaleInfo } from "../features/onSale/onSaleSlice"; +import MainView from "../views/MainView/MainView"; +import css from "./App.module.less"; function AppBase(props) { const dispatch = useDispatch(); @@ -16,6 +18,7 @@ function AppBase(props) { dispatch(getAuthenticationCode()); dispatch(getHomeMenu()); dispatch(getOnSaleInfo({ categoryIncFlag: "Y", lgCatCd: "" })); + dispatch(getBrandList()); }, [dispatch]); return ; diff --git a/com.twin.app.shoptime/src/api/apiConfig.js b/com.twin.app.shoptime/src/api/apiConfig.js index 278a5d0e..43f2a1d2 100644 --- a/com.twin.app.shoptime/src/api/apiConfig.js +++ b/com.twin.app.shoptime/src/api/apiConfig.js @@ -19,6 +19,11 @@ export const URLS = { GET_BRAND_LAYOUT_INFO: "/lgsp/v1/brand/shelf.lge", GET_BRAND_LIVE_CHANNEL_INFO: "/lgsp/v1/brand/live.lge", GET_BRAND_TODAYS_DEALS: "/lgsp/v1/brand/tsv.lge", + GET_BRAND_RECOMMENDED_SHOW_INFO: "/lgsp/v1/brand/recommend.lge", + GET_BRAND_CREATORS_INFO: "/lgsp/v1/brand/creators.lge", + GET_BRAND_SERIES_INFO: "/lgsp/v1/brand/series.lge", + GET_BRAND_CATEGORY_INFO: "/lgsp/v1/brand/category.lge", + GET_BRAND_BEST_SELLET: "/lgsp/v1/brand/best.lge", //on-sale controller GET_ON_SALE_INFO: "/lgsp/v1/onsale/onsale.lge", diff --git a/com.twin.app.shoptime/src/features/brand/featuredBrandsSlice.js b/com.twin.app.shoptime/src/features/brand/featuredBrandsSlice.js new file mode 100644 index 00000000..22daa224 --- /dev/null +++ b/com.twin.app.shoptime/src/features/brand/featuredBrandsSlice.js @@ -0,0 +1,51 @@ +import { createAsyncThunk, createSlice } from "@reduxjs/toolkit"; + +import { URLS } from "../../api/apiConfig"; +import { TAxios } from "../../api/TAxios"; + +// Featured Brands 정보 조회 IF-LGSP-304 +// @@pyh Todo, 기존의 key가 brandList에서 brandInfo로 변경 됨에 따라 함수명 또한 바뀔 수 있음 (문서 확인 후 변경 처리) +export const getBrandList = createAsyncThunk( + "featuredBrands/getBrandList", + + async (_, thunkAPI) => { + const onSuccess = (response) => { + console.log("getBrandList onSuccess ", response.data); + + thunkAPI.dispatch(featuredBrandsSlice.actions.updateBrandInfo(response.data.data)); + }; + + const onFail = (error) => { + console.log("getBrandList onFail", error); + }; + + TAxios( + thunkAPI.dispatch, + thunkAPI.getState, + "get", + URLS.GET_BRAND_LIST, + {}, + {}, + onSuccess, + onFail + ); + } +); + +const initialState = { + brandInfo: {}, +}; + +export const featuredBrandsSlice = createSlice({ + name: "featuredBrands", + initialState, + reducers: { + updateBrandInfo: (state, action) => { + state.featuredBrandsData = action.payload; + }, + }, +}); + +export const { updateBrandInfo } = featuredBrandsSlice.actions; + +export default featuredBrandsSlice.reducer; diff --git a/com.twin.app.shoptime/src/store/store.js b/com.twin.app.shoptime/src/store/store.js index 0b987def..812e8de8 100644 --- a/com.twin.app.shoptime/src/store/store.js +++ b/com.twin.app.shoptime/src/store/store.js @@ -1,11 +1,12 @@ import { configureStore } from "@reduxjs/toolkit"; import appDataReducer from "../features/appData/appDataSlice"; -import deviceReducer from "../features/device/deviceSlice"; +import featuredBrandsReducer from "../features/brand/featuredBrandsSlice"; import commonReducer from "../features/common/commonSlice"; -import panelsReducer from "../features/panels/panelsSlice"; +import deviceReducer from "../features/device/deviceSlice"; import homeReducer from "../features/home/homeSlice"; import onSaleReducer from "../features/onSale/onSaleSlice"; +import panelsReducer from "../features/panels/panelsSlice"; export const store = configureStore({ reducer: { @@ -15,5 +16,6 @@ export const store = configureStore({ common: commonReducer, home: homeReducer, onSale: onSaleReducer, + featuredBrands: featuredBrandsReducer, }, });