import { ProfileResponse, useAuth } from "@/lib/hooks";
import { UseQueryOptions, useQuery } from "@tanstack/react-query";
import { useQueryKey } from "../useQueryKey";

export const useGetProfile = (
  queryOptions?: Omit<UseQueryOptions<ProfileResponse>, "queryKey" | "queryFn">
) => {
  const keys = useQueryKey();
  const { getProfile } = useAuth();

  const result = useQuery<ProfileResponse>({
    queryKey: keys().auth().action("profile").get(),
    queryFn: getProfile,
    ...queryOptions,
  });

  return result;
};
