Last active
February 24, 2017 13:28
-
-
Save zgababa/05181cb404a6201bfb5f40a05b65cfab 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
'use strict'; | |
import request from 'superagent'; | |
const path = '/graphql'; | |
const queryParam = '?graphqlQuery='; | |
function getQuery(idPokemon) { | |
return ` | |
{ | |
pokemon(id: ${idPokemon}) { | |
name | |
orderFormatted | |
img | |
} | |
} | |
`; | |
} | |
function getPokemon(idPokemon) { | |
const uri = path + queryParam + getQuery(idPokemon); | |
return request.get(uri); | |
} | |
export default getPokemon; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment