apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Please!! How to Use GET ??

Open brightchip opened this issue 5 years ago • 2 comments

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
            }
        },

`

brightchip avatar Nov 04 '20 00:11 brightchip

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'
        }
}

aj-dev avatar Nov 24 '20 15:11 aj-dev

Thanks @aj-dev That worked for me.

lance-anderson avatar Mar 10 '21 17:03 lance-anderson