import { URLS } from "./apiConfig";
import api from "./axiosConfig";

// Onsale 조회 IF-LGSP-086
export async function getOnSaleInfo(props) {
  const { lgCatCd, categoryIncFlag } = props;

  try {
    const response = await api.get(URLS.GET_ON_SALE_INFO, {
      params: {
        categoryIncFlag,
        lgCatCd,
      },
    });

    return response.data.data;
  } catch (error) {
    const { response } = error;

    if (response) {
      const statusCode = response.status;
      const statusText = response.statusText;

      console.error(`Error: ${statusCode} ${statusText}`);
    }
  }
}
