Skip to content

Instantly share code, notes, and snippets.

@shanerbaner82
Created August 5, 2021 19:01
Show Gist options
  • Save shanerbaner82/7e79e41ce7baf7807998617a7d32cc11 to your computer and use it in GitHub Desktop.
Save shanerbaner82/7e79e41ce7baf7807998617a7d32cc11 to your computer and use it in GitHub Desktop.
<template>
<div>
<button @click="send">Fetch Results</button>
<div v-if="results">
<pre>
{{results}}
</pre>
</div>
</div>
</template>
<script>
export default {
name: "TestGraph",
data(){
return{
results: null,
query:`{
farmFactories(first: 10) {
id
farmCount
}
farms(first: 10) {
id
createdAtTimestamp
createdAtBlockNumber
reward {
id
}
}
}`
}
},
methods: {
async send(){
let x = await axios({
method: "POST",
url: "https://api.thegraph.com/subgraphs/name/crispymangoes/mumbaifarmcompounder",
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
data: {
query: this.query
}
});
this.results = x.data;
}
}
}
</script>
<style scoped>
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment