mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-04-24 03:00:09 -04: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
484 B
TypeScript
23 lines
484 B
TypeScript
import { Pokemon } from '../types/pokemon';
|
|
import { client } from './client';
|
|
|
|
const firstTwentyPokemonsQuery = `
|
|
query firstTwentyPokemons {
|
|
pokemons(first: 20) {
|
|
image
|
|
name
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const getPokemons = async (): Promise<Array<Pokemon>> => {
|
|
const {
|
|
data: { pokemons },
|
|
} = await client.query(firstTwentyPokemonsQuery).toPromise();
|
|
|
|
return pokemons.map((pokemon: Pokemon) => ({
|
|
...pokemon,
|
|
name: pokemon.name.toLowerCase(),
|
|
}));
|
|
};
|