Created
June 18, 2019 12:12
-
-
Save StrongerMyself/219c7968fefa59785a4d8f24606a4d09 to your computer and use it in GitHub Desktop.
Idea graphql client API
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
var api = new GraphQL(path, { | |
method: 'POST', // POST by default. | |
headers: { | |
'Access-Token': 'some-access-token' | |
}, | |
query: { | |
tags: 'tags { ...tag }', | |
tag: 'tag { ...tag }', | |
}, | |
mutation: { | |
tag: 'tag(input: $input, id: $id) { ...tag }', | |
}, | |
subscribe: { | |
tag: 'tag(input: $input, id: $id) { ...tag }', | |
}, | |
fragment: { | |
tag: 'on Tag { id name description }', | |
} | |
}) | |
api.state | |
api.req().then() | |
api.req(name).then() | |
let field = api.getState('field.key') | |
var entity = api.entity(initial, name, schema, fragment) | |
entity.state | |
entity.args | |
entity.req().then() | |
let field = entity.getState('field.key') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment