import { useQuery } from "@tanstack/react-query";
import * as api from "../service/LearningService";

export const useGetLearnings = (search: string) => {
  return useQuery({
    queryKey: ["learnings", search],
    queryFn: () => api.getLearnings(search),
  });
};

export const useGetLearningDetail = (id: string) => {
  return useQuery({
    queryKey: ["learning", id],
    queryFn: () => api.getLearningDetail(id),
    enabled: !!id,
  });
};
