query : function()

in org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/content/js/graphql.js [25:37]


        query : function(query, info, callback) {
            fetch('/graphql.json', {
                method: 'POST',
                headers: {
                'Content-Type': 'application/json',
                'Accept': 'application/json',
                },
                body: JSON.stringify({query: `${query} `})
            })
            .then(r => r.json())
            .then(json => callback ({ result: json.data, query: query, info: info}))
            ;
        }