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

// IF-LGSP-324 회원 Shipping Address 조회
export const getMyInfoShippingSearch = (props) => (dispatch, getState) => {
  const { mbrNo } = props;

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

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

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

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