From 58c7ef4d50bdf0709a0b69d9beeef3d8beeef882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20S=C3=A1ez?= Date: Thu, 8 Feb 2024 14:57:13 -0500 Subject: [PATCH] Get partial headers new option (#145) * Get partial headers new option * allow non promise too --- .changeset/old-mayflies-fry.md | 5 +++++ packages/graphql-react-query/src/client.ts | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .changeset/old-mayflies-fry.md diff --git a/.changeset/old-mayflies-fry.md b/.changeset/old-mayflies-fry.md new file mode 100644 index 00000000..f268a028 --- /dev/null +++ b/.changeset/old-mayflies-fry.md @@ -0,0 +1,5 @@ +--- +'@soundxyz/graphql-react-query': patch +--- + +Get partial headers new option diff --git a/packages/graphql-react-query/src/client.ts b/packages/graphql-react-query/src/client.ts index c3fde10d..af9cafb3 100644 --- a/packages/graphql-react-query/src/client.ts +++ b/packages/graphql-react-query/src/client.ts @@ -91,6 +91,8 @@ export function GraphQLReactQueryClient< fetcher: fetcherConfig, skipAbort, + + getPartialHeaders, }: { clientConfig?: QueryClientConfig; endpoint: string; @@ -100,6 +102,8 @@ export function GraphQLReactQueryClient< fetcher?: Fetcher; skipAbort?: [StringDocumentNode, ...StringDocumentNode[]] | boolean; + + getPartialHeaders?(): Promise>> | Partial>; }) { const skipAbortSet = skipAbort ? (skipAbort === true ? true : new Set(skipAbort)) : null; @@ -201,6 +205,7 @@ export function GraphQLReactQueryClient< ...headersGlobal, ...fetchOptions?.headers, ...extraFetchOptions?.headers, + ...(getPartialHeaders ? await getPartialHeaders() : {}), }), }, });