[product] bestSeller 관련 추가 사항
Detail Notes : 1. productSlice.js 추가 2. apiconfig.js 파일 내용 추가 3. App.js 파일 내용 추가 4. Store.js 파일 내용 추가
This commit is contained in:
@@ -10,6 +10,7 @@ import { getHomeMenu } from "../features/home/homeSlice";
|
||||
import { getMyRecommandedKeyword } from "../features/mypage/myPageSlice";
|
||||
import { getOnSaleInfo } from "../features/onSale/onSaleSlice";
|
||||
import { getSubCategory } from "../features/main/mainSlice";
|
||||
import { getBestSeller } from "../features/product/productSlice";
|
||||
import MainView from "../views/MainView/MainView";
|
||||
import css from "./App.module.less";
|
||||
|
||||
@@ -22,6 +23,7 @@ function AppBase(props) {
|
||||
dispatch(getOnSaleInfo({ categoryIncFlag: "Y", lgCatCd: "" }));
|
||||
dispatch(getBrandList());
|
||||
dispatch(getMyRecommandedKeyword());
|
||||
dispatch(getBestSeller());
|
||||
dispatch(
|
||||
getSubCategory({
|
||||
lgCatCd: "1000",
|
||||
|
||||
@@ -28,6 +28,9 @@ export const URLS = {
|
||||
//on-sale controller
|
||||
GET_ON_SALE_INFO: "/lgsp/v1/onsale/onsale.lge",
|
||||
|
||||
//product controller
|
||||
GET_PRODUCT_BESTSELLER: "/lgsp/v1/product/bestSeller.lge",
|
||||
|
||||
//my-page controller
|
||||
GET_MY_RECOMMANDED_KEYWORD: "/lgsp/v1/mypage/reckeyword.lge",
|
||||
|
||||
|
||||
49
com.twin.app.shoptime/src/features/product/productSlice.js
Normal file
49
com.twin.app.shoptime/src/features/product/productSlice.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
|
||||
import { URLS } from "../../api/apiConfig";
|
||||
import { TAxios } from "../../api/TAxios";
|
||||
|
||||
// Best Seller 상품 목록 조회 IF-LGSP-303
|
||||
export const getBestSeller = createAsyncThunk(
|
||||
"bestSeller/getBestSeller",
|
||||
async (_, thunkAPI) => {
|
||||
const onSuccess = (response) => {
|
||||
console.log("getBestSeller onSuccess", response.data);
|
||||
|
||||
thunkAPI.dispatch(
|
||||
productSlice.actions.updateBestSellerData(response.data.data)
|
||||
);
|
||||
};
|
||||
|
||||
const onFail = (error) => {
|
||||
console.log("getBestSeller onFail", error);
|
||||
};
|
||||
|
||||
TAxios(
|
||||
thunkAPI.dispatch,
|
||||
thunkAPI.getState,
|
||||
"get",
|
||||
URLS.GET_PRODUCT_BESTSELLER,
|
||||
{},
|
||||
{},
|
||||
onSuccess,
|
||||
onFail
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
const initialState = {
|
||||
bestSellerData: {},
|
||||
};
|
||||
|
||||
export const productSlice = createSlice({
|
||||
name: "product",
|
||||
initialState,
|
||||
reducers: {
|
||||
updateBestSellerData: (state, action) => {
|
||||
state.bestSellerData = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { updateBestSellerData } = productSlice.actions;
|
||||
export default productSlice.reducer;
|
||||
@@ -7,6 +7,7 @@ import deviceReducer from "../features/device/deviceSlice";
|
||||
import homeReducer from "../features/home/homeSlice";
|
||||
import myPageReducer from "../features/mypage/myPageSlice";
|
||||
import onSaleReducer from "../features/onSale/onSaleSlice";
|
||||
import productReducer from "../features/product/productSlice";
|
||||
import panelsReducer from "../features/panels/panelsSlice";
|
||||
import mainReducer from "../features/main/mainSlice";
|
||||
|
||||
@@ -20,6 +21,7 @@ export const store = configureStore({
|
||||
onSale: onSaleReducer,
|
||||
brand: brandReducer,
|
||||
myPage: myPageReducer,
|
||||
product: productReducer,
|
||||
main: mainReducer,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user