Skip to content

Instantly share code, notes, and snippets.

@zgababa
Last active February 24, 2017 13:28
Show Gist options
  • Save zgababa/05181cb404a6201bfb5f40a05b65cfab to your computer and use it in GitHub Desktop.
Save zgababa/05181cb404a6201bfb5f40a05b65cfab to your computer and use it in GitHub Desktop.
'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