1.0.2 • Published 2 years ago

graphql-api-fetch v1.0.2

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

GraphQLFetch

A GraphQL fetch library in Javasript

Installation

First, install the library:

npm i graphql-api-fetch

Usage

import { GraphQLFetch } from 'graphql-api-fetch';

const QUERY = `
      query ($keyword: String){
        users(keyword: $keyword){
            users{
                id
                email
                firstName
                lastName
            }
        }
      }`;

GraphQLFetch({
            query: QUERY,
            variables: { keyword } // optional
        }).then((res) => {
            if (res.errors) {
                errors = res.errors.map((error) => error.message);
            }
            else usersData = res.data.users.users;
        });

Contributers