Files
homelab-optimized/dashboard/ui/lib/use-poll.ts
Gitea Mirror Bot 24b249b290
Some checks failed
Documentation / Deploy to GitHub Pages (push) Has been cancelled
Documentation / Build Docusaurus (push) Has started running
Sanitized mirror from private repository - 2026-04-19 09:32:43 UTC
2026-04-19 09:32:43 +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,
});
}