mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 02:43:50 +00:00
34481b57c6
attempt fixing issues with cache becoming undefined
12 lines
310 B
JavaScript
12 lines
310 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: Infinity,
|
|
});
|
|
|
|
return { data, status, isError, refetch };
|
|
};
|