import { useQuery, type UseQueryOptions } from "@tanstack/react-query"; /** * Wrapper around useQuery to fetch data from an API endpoint */ export function useFetchQuery( url: string, options?: Omit, "queryKey" | "queryFn">, ) { return useQuery({ ...options, queryKey: [url], queryFn: () => fetch(url).then(res => res.json()), }); }