Source

apis/Shares.js

import { useMutation, useQuery } from "@tanstack/react-query";
import Axios from "../utils/ApiConfiguration";
/**
 * Custom hook to fetch a list of shares.
 *
 * This hook sends a request to retrieve a list of shares from the server.
 *
 * @returns {Object} The query result object.
 *
 * @example
 * // Usage of useGetShareList hook
 * const { data, isLoading, error } = useGetShareList();
 */
export const useGetShareList = () =>
  useQuery({
    queryKey: ["shares"],
    queryFn: () => Axios.get("share/"),
    refetchOnWindowFocus: false,
  });