0.0.5 • Published 2 years ago

@apollo-link-debug/handle-request v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@apollo-link-debug/handle-request

Debugs the operation name and variables used for a GraphQL request via apollo.

Installation

npm i @apollo-link-debug/handle-request
# - or -
yarn add @apollo-link-debug/handle-request

Usage

import { ApolloClient, ApolloLink, InMemoryCache } from '@apollo/client';
import { createRequestLink } from '@apollo-link-debug/handle-request';

const client = new ApolloClient({
  uri: 'https://localhost:3000/',
  cache: new InMemoryCache(),
  link: ApolloLink.from([createRequestLink()]),
});

const query = client.query({
  query: gql`query MyOperationName { ... }`,
  variables: {
    variableName: 'variableValue',
  },
});

Example output:

MyOperationName {
  "variableName": "variableValue"
}

Options

onRequest: ({ operation }) => void

A callback which occurs on every GraphQL request as the request is made. The default is to log the operation name and the variables (as JSON) used for the query.

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago