import axios from "@/config/axios";

import { CompareResponse } from "../types/Types";

export const getCompare = async (
  productIds: string[]
): Promise<CompareResponse> => {
  const params = new URLSearchParams();
  productIds.forEach((id) => {
    params.append("productIds", id);
  });
  const { data } = await axios.get(`/product/compare?${params.toString()}`);
  return data;
};

export const searchComparProduct = async (productId?: string) => {
  const { data } = await axios.get(
    `/product/compare/search?productId=${productId}`
  );
  return data;
};
