Passing more options to fetch
In nuxt.config.ts:
// nuxt.config.ts
module.exports = {
graphql: {
clients: {
default: {
endpoint: 'https://swapi-graphql.netlify.com/.netlify/functions/index',
options: {
credentials: 'include',
mode: 'cors',
},
},
},
},
};
Or using setHeaders / setHeader:
// Set a single header
this.$graphql.default.setHeader('credentials', 'include');
this.$graphql.default.setHeader('mode', 'cors');
// Override all existing headers
this.$graphql.default.setHeaders({
credentials: 'include',
mode: 'cors',
});