import useSWR from "swr";
import { fetchAPI } from "./api";

export function usePoll<T>(path: string, interval: number = 60000) {
  return useSWR<T>(path, () => fetchAPI<T>(path), {
    refreshInterval: interval,
    revalidateOnFocus: false,
  });
}
