Hi @webdev !
Thank you, I have succeeded in using the fetch API to wrap the GraphQL querry and inject it into the body like so:
async function getTotalValueLocked() {
try {
// globals
const url = `https://abc.abc.abc/graphql`,
query = `{
someData {
marketCap
swapVolume24h
}
}`;
// fetching data
const results = await fetch(url, {
method: `POST`,
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
query: query
})
});
// handling data
const data = await results.json();
console.log(data);
// handling error
} catch (error) {
console.log(`error`, error);
} // end try/catch
} // end getTotalValueLocked()
getTotalValueLocked();
works perfectly !