by hobbie I have created a pokedex where I want to register the shiny pokemons that I have captured, I have them saved in google spreadsheets, and I want to capture the data with JSon
I based myself on a youtube video (link below), and I modified some things, adding google spreadsheets to read the captured ones
This link have the project if you wanna see all: https://codepen.io/willy587/pen/pojNLGg
Ok the problem is when a want to read my spreadsheets i have this:
async function getPokemonStatus(id){
const response = await
fetch(`https://spreadsheets.google.com/feeds/list/1x5Nhf8T4kBGxyLxCskHUNlF0_PScXrrl3Wrc5C7PDhc/od6/public/values?alt=json`);
const data = await response.json();
const pkstatus = data.feed.entry[id].gsx$estado.$t;
console.log(pkstatus);//<--- show the status and is fine, works in that point
return pkstatus;//<------Here I try return the status because I want save in a variable/const
}
if (pokemon.id) {
pokemonEl.innerHTML = pokeInnerHTML2; //Here is the sprite of the pokemon
const status = getPokemonStatus(pokemon.id);// <---- When I do this save [Object Promise] {}
console.log(status);
} else {
pokemonEl.innerHTML = pokeInnerHTML; //Here is the missigno sprite, if I don't have the pokemon
}
I try use .then method, but it doesn't work either I look for others examples in the web but nothing I'm not a pro in javascript is my first code so if you can help me, I'll be grateful
you can see All the code in the codepen link, if you wanna work you there, Thanks
base code video https://www.youtube.com/watch?v=XL68br6JyYs
google spread:https://docs.google.com/spreadsheets/d/1x5Nhf8T4kBGxyLxCskHUNlF0_PScXrrl3Wrc5C7PDhc/edit#gid=0
this google spread is a example, the true google spread is another with the 800+ pokemon