diff --git a/src/urql/client.ts b/src/urql/client.ts index 2dc3d95..7caf0ff 100644 --- a/src/urql/client.ts +++ b/src/urql/client.ts @@ -50,8 +50,8 @@ function createCustomClient({ includeCredentials, }: { url: string; - apiToken: string; ssrCache: SSRExchange; + apiToken?: string; exchanges?: Exchange[]; includeCredentials?: boolean; }) { @@ -62,7 +62,7 @@ function createCustomClient({ (val: T): val is NonNullable => val !== null && val !== undefined, ), fetchOptions: () => ({ - headers: { authorization: `Bearer ${apiToken}` }, + headers: apiToken ? { authorization: `Bearer ${apiToken}` } : undefined, credentials: includeCredentials ? 'include' : undefined, }), });