Easy Minimal GraphQL client integration with Nuxt.js.
MIT License
Bot releases are visible (Hide)
Published by Gomah about 1 year ago
nuxt-graphql-request
with Nuxt 2, stick to v6: yarn add nuxt-graphql-request@v6
.Published by Gomah about 2 years ago
BREAKING CHANGES:
graphql-request
now invokes responseMiddleware
in error cases as well.
Features:
https://github.com/prisma-labs/graphql-request/commit/6246ffe47d3a4f849e43a36d4bbfda7518571ebe Allow async requestMiddleware (https://github.com/prisma-labs/graphql-request/pull/379)
https://github.com/prisma-labs/graphql-request/commit/2f221a4c5470c22dad7749b53cb1ed560727fd42 (breaking) Invoke responseMiddleware in error cases as well (https://github.com/prisma-labs/graphql-request/pull/372)
https://github.com/prisma-labs/graphql-request/commit/a7ac904e3c8bc820d4464d7559036eb9a58a062a TypedDocumentNode support & strict variable typings (https://github.com/prisma-labs/graphql-request/pull/350)
https://github.com/prisma-labs/graphql-request/commit/dec0319e27660e10bbd3a0e3c4e95f97c39fa973 added middleware support (https://github.com/prisma-labs/graphql-request/pull/170)
Fixes
https://github.com/prisma-labs/graphql-request/commit/55b1bf509a95faac042221765ff4fcd0723b1bfc resolve headers when cross fetch is not available in environment (https://github.com/prisma-labs/graphql-request/pull/296)
https://github.com/prisma-labs/graphql-request/commit/988b437103f57efbc642c87b6eded4b03ddef72c use GraphQLError from graphql module (https://github.com/prisma-labs/graphql-request/pull/365)
Published by Gomah over 3 years ago
BREAKING CHANGES
https://github.com/Gomah/nuxt-graphql-request/pull/13 Supports multiple clients, thanks @samturrell
Change to nuxt.config as v4 now supports multiple clients:
Before:
module.exports = {
buildModules: ['nuxt-graphql-request'],
graphql: {
/**
* The client endpoint url
*/
endpoint: 'https://swapi-graphql.netlify.com/.netlify/functions/index',
/**
* Options
* See: https://github.com/prisma-labs/graphql-request#passing-more-options-to-fetch
*/
options: {},
/**
* Optional
* default: true (this includes cross-fetch/polyfill before creating the graphql client)
*/
useFetchPolyfill: true,
/**
* Optional
* default: false (this includes graphql-tag for node_modules folder)
*/
includeNodeModules: true,
},
};
After:
module.exports = {
buildModules: ['nuxt-graphql-request'],
graphql: {
/**
* An Object of your GraphQL clients
*/
clients: {
default: {
/**
* The client endpoint url
*/
endpoint: 'https://swapi-graphql.netlify.com/.netlify/functions/index',
/**
* Per-client options overrides
* See: https://github.com/prisma-labs/graphql-request#passing-more-options-to-fetch
*/
options: {},
},
secondClient: {
// ...client config
},
// ...your other clients
},
/**
* Options
* See: https://github.com/prisma-labs/graphql-request#passing-more-options-to-fetch
*/
options: {},
/**
* Optional
* default: true (this includes cross-fetch/polyfill before creating the graphql client)
*/
useFetchPolyfill: true,
/**
* Optional
* default: false (this includes graphql-tag for node_modules folder)
*/
includeNodeModules: true,
},
};