mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 12:53:32 +00:00
improvements in react-query
- fetch to useFetch hook - refetch every 10s - sync browser tabs with experimental broadcastQueryClient
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { useQuery } from 'react-query';
|
||||
const refetchIntervalMs = 10000;
|
||||
|
||||
export const useFetch = (namespace, fn) => {
|
||||
const { data, status, isError, refetch } = useQuery(namespace, fn, {
|
||||
refetchInterval: refetchIntervalMs,
|
||||
});
|
||||
|
||||
return { data, status, isError, refetch };
|
||||
};
|
||||
Reference in New Issue
Block a user