mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-02-09 13:35:09 -05:00
* Remove unused models * add new props into Player model * Added props to Guild * Setting guild type as a foreign-key reference * Use foreign table for skills * Seed data * prettier
23 lines
450 B
TypeScript
23 lines
450 B
TypeScript
import { Pokemon } from '../types/pokemon';
|
|
import { client } from './client';
|
|
|
|
const pokemonQuery = `
|
|
query firstTwentyPokemons($name: String!) {
|
|
pokemon(name: $name) {
|
|
name
|
|
image
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const getPokemon = async (
|
|
name: string | undefined,
|
|
): Promise<Pokemon | null> => {
|
|
if (!name) return null;
|
|
const {
|
|
data: { pokemon },
|
|
} = await client.query(pokemonQuery, { name }).toPromise();
|
|
|
|
return pokemon;
|
|
};
|