mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 01:43:43 +00:00
6f634c36f9
* style: correct background colours * chore: add folder resolutions to vite * refactor: add auto refetch to HTTP APIs * fix: view settings override endpoint * refactor: memoize callbacks * fix: reorder reaching wrong data adapter * refactor: memoize callbacks * style: presentation cleanup * fix(delete): prevent flow with deleted event in playback * refactor: convert to typescript * refactor: small fixes and typescript conversion * ux: improve feedback on local changes * refactor: cleanup props
25 lines
647 B
TypeScript
25 lines
647 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
|
|
import { queryRefetchInterval } from '../../ontimeConfig';
|
|
import { USERFIELDS } from '../api/apiConstants';
|
|
import { getUserFields } from '../api/ontimeApi';
|
|
import { userFieldsPlaceholder } from '../models/UserFields.type';
|
|
|
|
export default function useUserFields() {
|
|
const {
|
|
data,
|
|
status,
|
|
isError,
|
|
refetch,
|
|
} = useQuery({
|
|
queryKey: USERFIELDS,
|
|
queryFn: getUserFields,
|
|
placeholderData: userFieldsPlaceholder,
|
|
retry: 5,
|
|
retryDelay: attempt => attempt * 2500,
|
|
refetchInterval: queryRefetchInterval,
|
|
});
|
|
|
|
return { data, status, isError, refetch };
|
|
}
|