Files
ontime/client/src/app/hooks/useFetch.js
T
cv 34481b57c6 fix: cache time infinite
attempt fixing issues with cache becoming undefined
2021-05-20 08:31:34 +02:00

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