Skip to content

Commit

Permalink
Get partial headers new option (#145)
Browse files Browse the repository at this point in the history
* Get partial headers new option

* allow non promise too
  • Loading branch information
PabloSzx authored Feb 8, 2024
1 parent f38de10 commit 58c7ef4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-mayflies-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soundxyz/graphql-react-query': patch
---

Get partial headers new option
5 changes: 5 additions & 0 deletions packages/graphql-react-query/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export function GraphQLReactQueryClient<
fetcher: fetcherConfig,

skipAbort,

getPartialHeaders,
}: {
clientConfig?: QueryClientConfig;
endpoint: string;
Expand All @@ -100,6 +102,8 @@ export function GraphQLReactQueryClient<
fetcher?: Fetcher;

skipAbort?: [StringDocumentNode, ...StringDocumentNode[]] | boolean;

getPartialHeaders?(): Promise<Partial<Record<string, string>>> | Partial<Record<string, string>>;
}) {
const skipAbortSet = skipAbort ? (skipAbort === true ? true : new Set<string>(skipAbort)) : null;

Expand Down Expand Up @@ -201,6 +205,7 @@ export function GraphQLReactQueryClient<
...headersGlobal,
...fetchOptions?.headers,
...extraFetchOptions?.headers,
...(getPartialHeaders ? await getPartialHeaders() : {}),
}),
},
});
Expand Down

0 comments on commit 58c7ef4

Please sign in to comment.