Skip to content

Commit

Permalink
fix: make api token optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Miron committed Feb 6, 2024
1 parent 7876818 commit 5b2365b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/urql/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ function createCustomClient({
includeCredentials,
}: {
url: string;
apiToken: string;
ssrCache: SSRExchange;
apiToken?: string;
exchanges?: Exchange[];
includeCredentials?: boolean;
}) {
Expand All @@ -62,7 +62,7 @@ function createCustomClient({
<T>(val: T): val is NonNullable<T> => val !== null && val !== undefined,
),
fetchOptions: () => ({
headers: { authorization: `Bearer ${apiToken}` },
headers: apiToken ? { authorization: `Bearer ${apiToken}` } : undefined,
credentials: includeCredentials ? 'include' : undefined,
}),
});
Expand Down

0 comments on commit 5b2365b

Please sign in to comment.