mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 20:03:52 +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
649 B
TypeScript
25 lines
649 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
|
|
import { queryRefetchIntervalSlow } from '../../ontimeConfig';
|
|
import { OSC_SETTINGS } from '../api/apiConstants';
|
|
import { getOSC } from '../api/ontimeApi';
|
|
import { oscPlaceholderSettings } from '../models/OscSettings.type';
|
|
|
|
export default function useOscSettings() {
|
|
const {
|
|
data,
|
|
status,
|
|
isError,
|
|
refetch,
|
|
} = useQuery({
|
|
queryKey: OSC_SETTINGS,
|
|
queryFn: getOSC,
|
|
placeholderData: oscPlaceholderSettings,
|
|
retry: 5,
|
|
retryDelay: attempt => attempt * 2500,
|
|
refetchInterval: queryRefetchIntervalSlow,
|
|
});
|
|
|
|
return { data, status, isError, refetch };
|
|
}
|