This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk-vue / useEnginexQuery

useEnginexQuery() ​

useEnginexQuery<T, TSelect>(getter, overrides?): UseQueryReturnType<TSelect, EnginexError>

TanStack useQuery over the options of an SDK factory, with the error typed as EnginexError. It takes a getter (not the options): it runs again when the session or any ref read inside it changes, and the key follows. The overrides (refetchInterval, select, enabled, staleTime, retry...) win over the factory options, except queryKey and queryFn.

  • Cancellation: unmounting the last component observing the query aborts the SDK fetch.
  • Retry: an UNAUTHENTICATED is not repeated, since it made no request; other errors follow the app's QueryClient retry. overrides.retry wins over both.
  • retry as a getter is not supported: pass a value (number, boolean, function) or a ref.

Type Parameters ​

T ​

T

TSelect ​

TSelect = T

Parameters ​

getter ​

() => EnginexQueryOptions<T>

Returns the options of a factory (() => q.wallet.getBalance()).

overrides? ​

EnginexQueryOverrides<T, TSelect>

useQuery options that override the factory's.

Returns ​

UseQueryReturnType<TSelect, EnginexError>

The useQuery result, with error typed as EnginexError.

Throws ​

If called in an app without the EnginexPlugin.

Example ​

ts
const q = useEnginexQueries()
const page = ref(1)
const { data, error } = useEnginexQuery(() => q.wallet.listTransactions({ page: page.value }))