Source

apis/ShareCertificate.js

import { useQuery } from "@tanstack/react-query";
import Axios from "../utils/ApiConfiguration";
/**
 * Custom hook to fetch a share certificate by ID.
 *
 * This hook sends a request to retrieve a share certificate by its ID from the server.
 *
 * @param {number} id - The ID of the share certificate to fetch.
 *
 * @returns {Object} The query result object.
 *
 * @example
 * // Usage of useGetShareCertificate hook
 * const { data, isLoading, error } = useGetShareCertificate(123);
 */
export const useGetShareCertificate = (id) =>
  useQuery({
    queryKey: ["share-certificate", id],
    queryFn: () => Axios.get(`certificate/${id}/`),
    refetchOnWindowFocus: true,
  });