import { URLS } from "../api/apiConfig";
import { TAxios } from "../api/TAxios";
import { types } from "./actionTypes";

// 회원의 등록 카드 정보 조회 IF-LGSP-332
export const getMyInfoCardSearch = (props) => (dispatch, getState) => {
  const { mbrNo } = props;

  const onSuccess = (response) => {
    console.log("getMyInfoCardSearch onSuccess: ", response.data);

    dispatch({
      type: types.GET_MY_INFO_CARD_SEARCH,
      payload: response.data.data,
    });
  };

  const onFail = (error) => {
    console.error("getMyInfoCardSearch OnFail: ", error);
  };

  TAxios(
    dispatch,
    getState,
    "get",
    URLS.GET_MY_INFO_CARD_SEARCH,
    { mbrNo },
    {},
    onSuccess,
    onFail
  );
};
