next.js/examples/with-urql/graphql/getPokemon.js
getPokemon.js19 lines330 B
import { client } from "./client";

const pokemonQuery = `
  query firstTwentyPokemons($name: String!) {
    pokemon(name: $name) {
      name
      image
    }
  }
`;

export const getPokemon = async (name) => {
  const {
    data: { pokemon },
  } = await client.query(pokemonQuery, { name }).toPromise();

  return pokemon;
};
Quest for Codev2.0.0
/
SIGN IN