Files
iNaturalistReactNative/src/sharedHooks/useQuery.ts
Ryan Stelly b78be9243d lint rule & autofix for "trailing comma" (#3299)
* (lint) MOB-1063 enforce trailing commas

* autofix trailing commas

* manually fix newly introduced maxlen violations

* add trailing comma convention to i18n build
2025-12-22 20:17:13 -06:00

21 lines
731 B
TypeScript

import type { QueryFunction } from "@tanstack/react-query";
import { useQuery } from "@tanstack/react-query";
import { handleRetryDelay, reactQueryRetry } from "sharedHelpers/logging";
// Should work like React Query's useQuery with our custom reactQueryRetry
const useNonAuthenticatedQuery = (
queryKey: Array<string>,
queryFunction: QueryFunction,
queryOptions: object = {},
) => useQuery( {
queryKey: [...queryKey, queryOptions.allowAnonymousJWT],
queryFn: queryFunction,
retry: ( failureCount, error ) => reactQueryRetry( failureCount, error, {
queryKey,
} ),
retryDelay: ( failureCount, error ) => handleRetryDelay( failureCount, error ),
...queryOptions,
} );
export default useNonAuthenticatedQuery;