MDK Logo

Query helpers

TanStack Query helpers for data fetching and mutations

TanStack Query helper functions for fetching API data, managing mutations, and configuring the query client. These utilities streamline integration with the MDK Gateway API.

Package

@tetherto/mdk-ui-foundation

Query helpers

@tetherto/mdk-ui-foundation

Import the public APIs on this page from @tetherto/mdk-ui-foundation.

createMdkQueryClient

Build the TanStack QueryClient an MDK app talks to its Gateway with.

(options: CreateMdkQueryClientOptions = {}) => QueryClient

getApiBaseUrl

Read the configured base URL back from a QueryClient. Falls back to the default when the client was not produced by createMdkQueryClient.

(client: QueryClient) => string

getFetcher

Read the client's auth-aware fetcher, or undefined for a client MDK did not build. Use it to call your Gateway routes with the session's token.

(client: QueryClient) => Fetcher | undefined

getMdkRuntime

Read the whole runtime at once. baseUrl is always resolved.

(client: QueryClient) => MdkRuntime

mdkFetch

Module-level singleton bearer fetcher reading from the global authStore. Used as the default by the mining query factories (tailLogQuery, etc.).

Fetcher

resolveApiBaseUrl

Resolves the API base URL:

(override?: string) => string

On this page