1.3.2 • Published 7 years ago

axioql v1.3.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

axioql

GraphQL client that uses axios under the hood.

Installation

Use your usual package manager.

yarn add axioql

Usage

import AxioQL from 'axioql';

// Set the endpoint that will be used for all your GraphQL requests
AxioQL.setQLEndpoint('https://graphql.server.com/graphql');

// If you have to authenticate use this method to set the header
AxioQL.setAuthHeader('Bearer #sometoken#');

// Create a query
const someQuery = `query ($searchText: String!) {
  productSearch(title: $searchText) {
    id
    title
    brand
  }
}`;

// Add variables used by the query
const someVariables = {
  searchText: 'Milk',  
};

const yourAsyncMethod = async () => {
  try {
    // Fetch your data
    const response = await AxioQL.request({ query: someQuery, variables: someVariables });

    console.log(response.data.data);
  } catch (error) {
    console.error(error);
  }
};
1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago