Source

apis/Notifications.js

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