@amoutonbrady/graphql-client
Advanced tools
Comparing version 0.3.0 to 0.3.1
// src/graphql-client.ts | ||
function GraphQLClient(url, options = { fetch: fetch.bind(window), auth: "" }) { | ||
let authorization = options.auth; | ||
function GraphQLClient(url, options) { | ||
let authorization = options.auth || ""; | ||
let headers = {}; | ||
const fetchFunc = options.fetch || fetch; | ||
const setHeaders = (newHeaders, override = false) => { | ||
@@ -10,3 +11,3 @@ headers = override ? newHeaders : { ...headers, ...newHeaders }; | ||
const request = (query, variables) => { | ||
return options.fetch(url, { | ||
return fetchFunc(url, { | ||
method: "POST", | ||
@@ -13,0 +14,0 @@ body: JSON.stringify({ query, variables }), |
@@ -21,3 +21,3 @@ import type nodeFetch from 'node-fetch'; | ||
*/ | ||
export declare function GraphQLClient(url: string, options?: Options): { | ||
export declare function GraphQLClient(url: string, options: Options): { | ||
request: <T = any>(query: string, variables?: Record<string, any>) => Promise<T>; | ||
@@ -24,0 +24,0 @@ setAuth: (token: string) => string; |
{ | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"name": "@amoutonbrady/graphql-client", | ||
@@ -4,0 +4,0 @@ "description": "Minimalistic GraphQL client", |
@@ -0,0 +0,0 @@ <img alt="preview badge" src="https://img.shields.io/bundlephobia/min/@amoutonbrady/graphql-client"> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5329
77