mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 01:43:43 +00:00
c56c5a636d
* chore: upgrade dependencies * chore: remove unused * fix: issue with missing index data * fix: discrepancy on counting events * fix: swapped classes * fix: prevent attempting load in empty list * chore: cleanup completed * chore: remove unused * refactor: convert to typescript * refactor: migrate to new endpoints * refactor: convert to typescript * fix: prevent issue with undefined process * fix: small code smells * fix: issue with missing version variable on build * refactor: configure retries on data fetching * style: design review * fix: prevent cursor out of range * lint: react query linting * style: checkbox styles
23 lines
518 B
TypeScript
23 lines
518 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
|
|
import { APP_INFO } from '../api/apiConstants';
|
|
import { getInfo } from '../api/ontimeApi';
|
|
import { ontimePlaceholderInfo } from '../models/Info.types';
|
|
|
|
export default function useInfo() {
|
|
const {
|
|
data,
|
|
status,
|
|
isError,
|
|
refetch,
|
|
} = useQuery({
|
|
queryKey: APP_INFO,
|
|
queryFn: getInfo,
|
|
placeholderData: ontimePlaceholderInfo,
|
|
retry: 5,
|
|
retryDelay: attempt => attempt * 2500,
|
|
});
|
|
|
|
return { data, status, isError, refetch };
|
|
}
|