mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 04:43:35 +00:00
Refact/project (#189)
* refactor: cleanup project entry point * refactor: remove unused * refactor: folder restructure
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
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 };
|
||||
};
|
||||
Reference in New Issue
Block a user