import axiosInstance from "@/lib/axios";
import { useQuery } from "@tanstack/react-query";

// Fetcher that accepts `input` as a parameter
const fetchUserPreferredMatches = async () => {
  const userId = localStorage.getItem("userId");

  const { data } = await axiosInstance.get(`/users/${userId}/preferred-matches`);

  return data;
};

export const useGetUserPreferredMatches = () => {
  return useQuery({
    queryKey: ["PreferredMatchesData"],
    queryFn: fetchUserPreferredMatches,
    staleTime: 1000 * 60 * 10,
    refetchOnWindowFocus: false,
  });
};
