Przejdź do głównej zawartości

Interface: StorefrontClient

Methods

mutate()

mutate<T, V>(document, variables?, options?): Promise<T>

Execute a typed GraphQL mutation.

Mutations are never cached and never retried by retry middleware. Pass MutateOptions as the third argument for an abort signal.

Type Parameters

T

T = unknown

V

V = Record<string, unknown>

Parameters

document

string | TypedDocumentLike<T, V>

variables?

V

options?

MutateOptions

Returns

Promise<T>


query()

query<T, V>(document, variables?, options?): Promise<T>

Execute a typed GraphQL query.

Accepts any typed document (the SDK's TypedDocumentString or a graphql-codegen client-preset document) or a plain string. Pass QueryOptions as the third argument for the cache strategy and/or an abort signal.

Type Parameters

T

T = unknown

V

V = Record<string, unknown>

Parameters

document

string | TypedDocumentLike<T, V>

variables?

V

options?

QueryOptions

Returns

Promise<T>


use()

use(middleware): void

Add middleware to the pipeline (imperative API).

Invalidates the compiled pipeline — next request re-composes.

Parameters

middleware

Middleware

Returns

void