Created
February 5, 2023 19:40
-
-
Save fforw/2e8a12baf9ef430d5bb410f83c624880 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
| // query is a GraphQL query definition and variables an object whose keys are variable values for that definition | |
| fetch( | |
| "/graphql", | |
| { | |
| method: "POST", | |
| credentials: "same-origin", | |
| headers: { | |
| "Content-Type": "application/json" | |
| }, | |
| body: JSON.stringify({ | |
| query, | |
| variables | |
| }) | |
| } | |
| ) | |
| .then(response => response.json()) | |
| .then(({ data, errors}) => ... ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment