10 lines
251 B
TypeScript
10 lines
251 B
TypeScript
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,
|
|
});
|
|
}
|