Files
homelab-optimized/dashboard/ui/lib/use-poll.ts
Gitea Mirror Bot c57a7318c3
Some checks failed
Documentation / Deploy to GitHub Pages (push) Has been cancelled
Documentation / Build Docusaurus (push) Has been cancelled
Sanitized mirror from private repository - 2026-04-19 08:18:25 UTC
2026-04-19 08:18:25 +00:00

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,
});
}