Last active
September 30, 2016 02:14
-
-
Save philiptzou/93019da458c429b3a13513ba9b79407c 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
/** | |
* A simple script to initial a request to Sierra GraphQL service | |
* and then output current HIVDB version in an alert window. | |
*/ | |
window.fetch('https://hivdb.stanford.edu/graphql', { | |
method: 'post', | |
headers: { 'Content-Type': 'application/json' }, | |
body: JSON.stringify({ | |
query: 'query { viewer { currentVersion { text } } }', | |
variables: {} | |
}) | |
}) | |
.then(response => response.json()) | |
.then(({data: {viewer: {currentVersion}}}) => ( | |
alert(`Current HIVDB version: ${currentVersion.text}`) | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment