SearchPanel 작업 진행 중 - chw
This commit is contained in:
52
com.twin.app.shoptime/src/features/mypage/myPageSlice.js
Normal file
52
com.twin.app.shoptime/src/features/mypage/myPageSlice.js
Normal file
@@ -0,0 +1,52 @@
|
||||
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
import { URLS } from "../../api/apiConfig";
|
||||
import { TAxios } from "../../api/TAxios";
|
||||
|
||||
// 추천 Keyword 목록 조회 IF-LGSP-055
|
||||
export const getMyRecommandedKeyword = createAsyncThunk(
|
||||
"myPage/getMyRecommandedKeyword",
|
||||
|
||||
async (_, thunkAPI) => {
|
||||
const onSuccess = (response) => {
|
||||
console.log("getMyRecommandedKeyword onSuccess ", response.data);
|
||||
|
||||
thunkAPI.dispatch(
|
||||
myPageSlice.actions.updateRecommandedKeywordData(response.data)
|
||||
);
|
||||
};
|
||||
|
||||
const onFail = (error) => {
|
||||
console.error("getMyRecommandedKeyword onFail ", error);
|
||||
};
|
||||
|
||||
TAxios(
|
||||
thunkAPI.dispatch,
|
||||
thunkAPI.getState,
|
||||
"get",
|
||||
URLS.GET_MY_RECOMMANDED_KEYWORD,
|
||||
{},
|
||||
{},
|
||||
onSuccess,
|
||||
onFail
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
const initialState = {
|
||||
recommandedKeywordData: {},
|
||||
};
|
||||
|
||||
export const myPageSlice = createSlice({
|
||||
name: "myPage",
|
||||
initialState,
|
||||
reducers: {
|
||||
updateRecommandedKeywordData: (state, action) => {
|
||||
state.recommandedKeywordData = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { updateRecommandedKeywordData } = myPageSlice.actions;
|
||||
|
||||
export default myPageSlice.reducer;
|
||||
Reference in New Issue
Block a user