Add evolution chain to Pokemon

This commit is contained in:
Dragon Fire
2020-03-25 20:46:32 -04:00
parent d2c8473dc0
commit 82dbca2b75
4 changed files with 45 additions and 5 deletions
+2 -2
View File
@@ -12,13 +12,13 @@ module.exports = class PokemonStore extends Collection {
const found = this.find(pokemon => pokemon.slug === query);
if (found) return found;
if (query === 'missingno' || num === 0) {
const pokemon = new Pokemon(missingno);
const pokemon = new Pokemon(this, missingno);
this.set(pokemon.id, pokemon);
return pokemon;
}
try {
const { body } = await request.get(`https://pokeapi.co/api/v2/pokemon-species/${query}/`);
const pokemon = new Pokemon(body);
const pokemon = new Pokemon(this, body);
this.set(pokemon.id, pokemon);
return pokemon;
} catch (err) {