UNPKG

@chargetrip/codegen-chargetrip-fetch

Version:

A customFetch implementation for using @graphql-codegen with Chargetrip GraphQL APIs

22 lines (17 loc) 525 B
const fetch = require("node-fetch"); const { getIntrospectionQuery } = require('graphql'); async function codegenFetch(url, options) { const introspectionQuery = getIntrospectionQuery() newOptions = { ...options, body: JSON.stringify({ variables: {}, operationName: "IntrospectionQuery", query: introspectionQuery }) } return fetch(url, newOptions); } module.exports = exports = codegenFetch; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports;