Last active
September 11, 2018 21:29
-
-
Save dlbnco/5949ebc6b9c68d7f90bdc8bbd700c222 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
import axios from 'axios'; | |
import { print } from 'graphql'; | |
import gql from 'graphql-tag'; | |
import apiUrl from '../config'; | |
const GET_CANDY = gql` | |
query candy ( | |
$name: String | |
) { | |
candy ( | |
name: $name | |
) { | |
id | |
name | |
effects | |
} | |
}`; | |
axios({ | |
method: 'post', | |
url: apiUrl, | |
data: { | |
query: print(GET_CANDY), | |
variables: { | |
name: candyNameFilter, | |
} | |
} | |
}).then(() => { | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment