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

// IF-LGSP-328 : 회원 Billing Address 조회
export const getMyInfoBillingSearch = (props) => (dispatch, getState) => {
  const { mbrNo } = props;

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

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

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

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