0.0.1 • Published 2 years ago
@backpackjs/client v0.0.1
@pack/client
The @pack/client package provides a client for interacting with the Pack GraphQL API.
Installation
npm install @pack/clientUsage
The client needs to be configured with your store's token, which can be found in the Pack admin under Settings > Developer > API Keys.
import { PackClient } from '@pack/client';
const packClient = new PackClient({
token: 'YOUR_TOKEN',
contentEnvironment: 'production'
});
const { data, error } = await packClient.fetch(QUERY, OPTIONS);- QUERY - The GraphQL query string
OPTIONS - Optional
PackFetchOptionsvariables- Object containing any GraphQL variables
Returns a promise resolving to:
data- The data returned by the GraphQL APIerror- Any error that occurred, with additional info
Development
# install dependencies
yarn
# build package
yarn build
# test package
yarn test0.0.1
2 years ago