Created
June 28, 2018 15:29
-
-
Save jwaldrip/38b711061f754c3f46f126dcd9bdc5b3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// @flow | |
async function fetchLanguage(lang: string, fields: Array<string>) { | |
await response = fetch({ | |
method: "POST", | |
headers: { | |
"content-type": "application/json" | |
}, | |
body: JSON.stringify({ | |
query: ` | |
query FetchLanguage($lang: String!) { | |
languageDictionary(lang: $lang) { | |
${fields.join(", ")} | |
} | |
} | |
`, | |
arguments: { | |
lang | |
} | |
}), | |
}); | |
const { data } = await response.json(); | |
return data.languageDictionary; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment