mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-07 08:23:55 +00:00
21 lines
693 B
TypeScript
21 lines
693 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
|
|
import { queryRefetchIntervalSlow } from '../../ontimeConfig';
|
|
import { VIEW_SETTINGS } from '../api/constants';
|
|
import { getView } from '../api/viewSettings';
|
|
import { viewsSettingsPlaceholder } from '../models/ViewSettings.type';
|
|
|
|
export default function useViewSettings() {
|
|
const { data, status, isFetching, isError, refetch } = useQuery({
|
|
queryKey: VIEW_SETTINGS,
|
|
queryFn: getView,
|
|
placeholderData: viewsSettingsPlaceholder,
|
|
retry: 5,
|
|
retryDelay: (attempt) => attempt * 2500,
|
|
refetchInterval: queryRefetchIntervalSlow,
|
|
networkMode: 'always',
|
|
});
|
|
|
|
return { data, status, isError, refetch, isFetching };
|
|
}
|