mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
* (lint) MOB-1063 enforce trailing commas * autofix trailing commas * manually fix newly introduced maxlen violations * add trailing comma convention to i18n build
21 lines
731 B
TypeScript
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;
|