mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 03:13:47 +00:00
c075f73752
* feat: create loader component * fix: prevent stale data in forms
20 lines
588 B
TypeScript
20 lines
588 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
|
|
import { queryRefetchIntervalSlow } from '../../ontimeConfig';
|
|
import { ALIASES } from '../api/apiConstants';
|
|
import { getAliases } from '../api/ontimeApi';
|
|
|
|
export default function useAliases() {
|
|
const { data, status, isFetching, isError, refetch } = useQuery({
|
|
queryKey: ALIASES,
|
|
queryFn: getAliases,
|
|
placeholderData: [],
|
|
retry: 5,
|
|
retryDelay: (attempt) => attempt * 2500,
|
|
refetchInterval: queryRefetchIntervalSlow,
|
|
networkMode: 'always',
|
|
});
|
|
|
|
return { data, status, isFetching, isError, refetch };
|
|
}
|