diff --git a/com.twin.app.shoptime/src/App/App.js b/com.twin.app.shoptime/src/App/App.js index e11c6094..b999aa47 100644 --- a/com.twin.app.shoptime/src/App/App.js +++ b/com.twin.app.shoptime/src/App/App.js @@ -7,6 +7,7 @@ import MainView from "../views/MainView/MainView"; import { useDispatch } from "react-redux"; import { getAuthenticationCode } from "../features/device/deviceSlice"; import { getHomeMenu } from "../features/home/homeSlice"; +import { getOnSaleInfo } from "../features/onSale/onSaleSlice"; function AppBase(props) { const dispatch = useDispatch(); @@ -14,6 +15,7 @@ function AppBase(props) { useEffect(() => { dispatch(getAuthenticationCode()); dispatch(getHomeMenu()); + dispatch(getOnSaleInfo({ categoryIncFlag: "Y", lgCatCd: "" })); }, [dispatch]); return ; diff --git a/com.twin.app.shoptime/src/features/onSale/onSaleSlice.js b/com.twin.app.shoptime/src/features/onSale/onSaleSlice.js new file mode 100644 index 00000000..060b88ed --- /dev/null +++ b/com.twin.app.shoptime/src/features/onSale/onSaleSlice.js @@ -0,0 +1,51 @@ +import { createAsyncThunk, createSlice } from "@reduxjs/toolkit"; + +import { URLS } from "../../api/apiConfig"; +import { TAxios } from "../../api/TAxios"; + +// On Sale 조회 IF-LGSP-086 +export const getOnSaleInfo = createAsyncThunk( + "onSale/getOnSaleInfo", + + async (props, thunkAPI) => { + const { categoryIncFlag, lgCatCd } = props; + const onSuccess = (response) => { + console.log("getOnSaleInfo onSuccess ", response.data); + + thunkAPI.dispatch(onSaleSlice.actions.updateOnSaleData(response.data.data)); + }; + + const onFail = (error) => { + console.log("getOnSaleInfo onFail", error); + }; + + TAxios( + thunkAPI.dispatch, + thunkAPI.getState, + "get", + URLS.GET_ON_SALE_INFO, + { categoryIncFlag, lgCatCd }, + {}, + onSuccess, + onFail + ); + } +); + +const initialState = { + onSaleData: {}, +}; + +export const onSaleSlice = createSlice({ + name: "onSale", + initialState, + reducers: { + updateOnSaleData: (state, action) => { + state.onSaleData = action.payload; + }, + }, +}); + +export const { updateOnSaleData } = onSaleSlice.actions; + +export default onSaleSlice.reducer; diff --git a/com.twin.app.shoptime/src/store/store.js b/com.twin.app.shoptime/src/store/store.js index 25e0d76f..0b987def 100644 --- a/com.twin.app.shoptime/src/store/store.js +++ b/com.twin.app.shoptime/src/store/store.js @@ -5,6 +5,7 @@ import deviceReducer from "../features/device/deviceSlice"; import commonReducer from "../features/common/commonSlice"; import panelsReducer from "../features/panels/panelsSlice"; import homeReducer from "../features/home/homeSlice"; +import onSaleReducer from "../features/onSale/onSaleSlice"; export const store = configureStore({ reducer: { @@ -13,5 +14,6 @@ export const store = configureStore({ appData: appDataReducer, common: commonReducer, home: homeReducer, + onSale: onSaleReducer, }, }); diff --git a/com.twin.app.shoptime/src/views/OnSalePanel/CategoryNav/CategoryNav.jsx b/com.twin.app.shoptime/src/views/OnSalePanel/CategoryNav/CategoryNav.jsx index 84316bdb..f9a12398 100644 --- a/com.twin.app.shoptime/src/views/OnSalePanel/CategoryNav/CategoryNav.jsx +++ b/com.twin.app.shoptime/src/views/OnSalePanel/CategoryNav/CategoryNav.jsx @@ -17,7 +17,7 @@ const SpottableComponent = Spottable("li"); export default function CategoryNav({ categoryInfos, - currentLgCatCdIndex, + currentLgCatCd, onCategoryNavClick, ...rest }) { @@ -31,15 +31,12 @@ export default function CategoryNav({ >