graphql-api-fetch
v1.0.2
Published
GraphQL client powered by axios
Downloads
2
Maintainers
Readme
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;
});