apollo
apollo copied to clipboard
Please!! How to Use GET ??
The queries are working with POST by default. But I need to change it into GET . And I couldn't figure out
` apollo: {
clientConfigs: {
default: {
httpEndpoint: process.env.apolloServer,
persisting: true,
useGETForHashedQueries: true,
useGETForQueries: true,
fetchOptions: {
useGETForQueries: true
}
},
`
Add apollo-link-http to your package.json dependencies.
Use the following in ~/plugins/apollo/default-config.js:
import { createHttpLink } from 'apollo-link-http';
export default function ({ env }) {
const link = createHttpLink({
uri: process.server ? env.graphQlUrl : env.browserGraphQlUrl,
useGETForQueries: true
});
return {
defaultHttpLink: false,
link
};
}
Then in nuxt.config.js:
apollo: {
clientConfigs: {
default: '~/plugins/apollo/default-config.js'
}
}
Thanks @aj-dev That worked for me.