Source

apis/Reports.js

import { useMutation, useQuery } from "@tanstack/react-query";
import Axios from "../utils/ApiConfiguration";
/**
 * Custom hook to fetch company reports.
 *
 * This hook sends a request to retrieve company reports from the server.
 *
 * @returns {Object} The query result object.
 * @throws {Error} If there's an issue with fetching company reports.
 *
 * @example
 * // Usage of useGetReports hook
 * const { data, isLoading, error } = useGetReports();
 */
export const useGetReports = () =>
  useQuery({
    queryKey: ["reports"],
    queryFn: () => Axios.get("companyreport/"),
    refetchOnWindowFocus: false,
  });