import { blogService, IBlogQueryParams } from "@/api/services/blog.service";
import { queryKeys } from "@/utils/queryKeys";
import { useQuery } from "@tanstack/react-query";


export const useBlogs = (params?: IBlogQueryParams) => {
  return useQuery({
    queryKey: [...queryKeys.blogs, params],
    queryFn: () => blogService.getBlogs(params),
  });
};

export const useBlogById = (id: string) => {
  return useQuery({
    queryKey: queryKeys.blog(id),
    queryFn: () => blogService.getBlogById(id),
    enabled: !!id,
  });
};