Created
August 5, 2021 19:01
-
-
Save shanerbaner82/7e79e41ce7baf7807998617a7d32cc11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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