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 = {}) => QueryClientgetApiBaseUrl
Read the configured base URL back from a QueryClient. Falls back to the default when the client was not produced by createMdkQueryClient.
(client: QueryClient) => stringgetFetcher
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 | undefinedgetMdkRuntime
Read the whole runtime at once. baseUrl is always resolved.
(client: QueryClient) => MdkRuntimemdkFetch
Module-level singleton bearer fetcher reading from the global authStore. Used as the default by the mining query factories (tailLogQuery, etc.).
FetcherresolveApiBaseUrl
Resolves the API base URL:
(override?: string) => stringAPI helpers
@tetherto/mdk-ui-foundation
Import the public APIs on this page from @tetherto/mdk-ui-foundation.
describeRequestError
A one-line, operator-facing reason a request to url failed. An app's own ERR_ message wins; otherwise the HTTP status says whether nothing serves the route (404), the Gateway refused it (401/403) or nothing answered (5xx). Any other er…
(error: unknown, url: string, { unreachableHint }: DescribeRequestErrorOptions = {}) => string