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

// 이벤트 정보 조회 IF-LGSP-070
export const getWelcomeEventInfo = () => (dispatch, getState) => {
  const onSuccess = (response) => {
    console.log("getWelcomeEventInfo onSuccess ", response.data);

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

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

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