I'm trying to get the list of the items (pokemon) from the api using axios, and map to return just the name of the pokemon, but I just get the Promise, I have no idea what I'm doing wrong.
import axios from "axios";
class Pokemon {
async all() {
try{
const response = await axios.get("https://pokeapi.co/api/v2/pokemon?limit=9")
return await response.data.results.map(item => item.name)
}catch (error){
console.log(error);
}
}
}
const pokemon = new Pokemon
const listPokemon = pokemon.all();
console.log(listPokemon); // Promise { <pending> }