redux-toolkit -> redux 마이그레이션 및 TAxios 로직 수정

This commit is contained in:
hyunwoo93.cha
2024-02-01 01:44:12 +09:00
parent a812c70ebe
commit 1c9ce1c5b8
90 changed files with 2228 additions and 1943 deletions

View File

@@ -0,0 +1,89 @@
import { URLS } from "../api/apiConfig";
import { TAxios } from "../api/TAxios";
import { types } from "./actionTypes";
// Featured Brands 정보 조회 IF-LGSP-304
// @@pyh Todo, 기존의 key가 brandList에서 brandInfo로 변경 됨에 따라 함수명 또한 바뀔 수 있음 (문서 확인 후 변경 처리)
export const getBrandList = () => (dispatch, getState) => {
const onSuccess = (response) => {
console.log("@@ getBrandList onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_LIST,
payload: response.data.data,
});
};
const onFail = (error) => {
console.error("@@ getBrandList onFail", error);
};
TAxios(
dispatch,
getState,
"get",
URLS.GET_BRAND_LIST,
{},
{},
onSuccess,
onFail
);
};
// Featured Brands LAYOUT (shelf) 정보 조회 IF-LGSP-305
export const getBrandLayoutInfo = (props) => (dispatch, getState) => {
const { patnrId } = props;
const onSuccess = (response) => {
console.log("@@ getBrandLayoutInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_LAYOUT_INFO,
payload: response.data.data,
});
};
const onFail = (error) => {
console.error("@@ getBrandLayoutInfo onFail ", error);
};
TAxios(
dispatch,
getState,
"get",
URLS.GET_BRAND_LAYOUT_INFO,
{ patnrId },
{},
onSuccess,
onFail
);
};
// Featured Brands Live 채널 정보 조회 IF-LGSP-306
export const getBrandLiveChannelInfo = (props) => (dispatch, getState) => {
const { patnrId } = props;
const onSuccess = (response) => {
console.log("@@ getBrandLiveChannelInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_LIVE_CHANNEL_INFO,
payload: response.data.data,
});
};
const onFail = (error) => {
console.error("@@ getBrandLiveChannelInfo onFail ", error);
};
TAxios(
dispatch,
getState,
"get",
URLS.GET_BRAND_LIVE_CHANNEL_INFO,
{ patnrId },
{},
onSuccess,
onFail
);
};