Created
September 15, 2021 13:25
-
-
Save Streeterxs/3e6e0b18aa00e7b9af701950b5b575f0 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
import { graphql } from 'react-relay'; | |
import { getNode } from 'relay-runtime'; | |
const ShoesListQuery = graphql` | |
query ShoesListQuery { | |
shoes { | |
size | |
type | |
} | |
} | |
`; | |
const shoesStatusNode = getNode(ShoesListQuery); | |
const url = '<my-graphql-server-url>'; | |
await fetch(url, { | |
method: 'POST', | |
headers: { | |
Accept: 'application/json', | |
'Content-type': 'application/json', | |
}, | |
body: JSON.stringify({ | |
query: shoesStatusNode.params.text, | |
operationName: shoesStatusNode.operation.name, | |
variables: {}, | |
}), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment