[mainSlice] 홈화면 popular show 연결을 위한 api
This commit is contained in:
@@ -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 <MainView />;
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user