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

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

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

  return data;
};

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