Files
ontime/client/src/app/hooks/useFetch.js
T
Carlos Valente 6ac963684d V1 (#118)
* chore: upgrade minor versions
* chore: upgrade cypress
* chore: upgrade fe dependencies
* update readme
* update osx images
* update readme
* upgrade dependencies
* upgrade test dependency
* feat: add option to input autofill
* feat: autofill to the left
* chore: update docs
* chore: cleanup ci
* version bump
* style: prevent zero height bar
* fix: prevent loosing menu
* ux: improve input, no spellcheck or autocomplete
* small ux improvements in cuesheets
* feat 111/increase maximum number of events
* fix: optimistic delete issue with filter
* refact: pincode workflow
* chore: add versioning to packages
2022-05-19 10:48:56 +02:00

18 lines
441 B
JavaScript

import { useQuery } from 'react-query';
const refetchIntervalMs = 10000;
/**
* @description utility hook to simplify query config
* @param namespace
* @param fn
*/
export const useFetch = (namespace, fn) => {
const { data, status, isError, refetch } = useQuery(namespace, fn, {
refetchInterval: refetchIntervalMs,
cacheTime: Infinity,
notifyOnChangeProps: 'tracked',
});
return { data, status, isError, refetch };
};