mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-09 01:13:55 +00:00
f1face2592
still trying to figure out why cache becomes undefined sometimes
12 lines
319 B
JavaScript
12 lines
319 B
JavaScript
import { useQuery } from 'react-query';
|
|
const refetchIntervalMs = 10000;
|
|
|
|
export const useFetch = (namespace, fn) => {
|
|
const { data, status, isError, refetch } = useQuery(namespace, fn, {
|
|
refetchInterval: refetchIntervalMs,
|
|
cacheTime: refetchIntervalMs,
|
|
});
|
|
|
|
return { data, status, isError, refetch };
|
|
};
|