fixed all the last big bugs before going to PWA

This commit is contained in:
maxluli
2022-10-11 09:02:09 +02:00
parent c475b6323d
commit cb8162214f
4 changed files with 36 additions and 4 deletions
+7 -3
View File
@@ -160,7 +160,7 @@
}
document.getElementById('likeButton').onclick = function () {
if (LoadedSuccessfully) {
saveToIndexedDB("likes", CurrentPokemon);
//saveToIndexedDB("likes", CurrentPokemon);
storeToApi("likes",CurrentPokemon);
loadNewPokemon();
}
@@ -173,7 +173,7 @@
}
document.getElementById('favoriteButton').onclick = function () {
if (LoadedSuccessfully) {
saveToIndexedDB("favorites", CurrentPokemon);
//saveToIndexedDB("favorites", CurrentPokemon);
storeToApi("favorites",CurrentPokemon);
loadNewPokemon();
}
@@ -263,7 +263,11 @@
fetch("https://633bde0df11701a65f69abe8.mockapi.io/api/v1/"+storeName+"/", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.then(result => {
let addedPokemon = JSON.parse(result);
console.log(addedPokemon);
saveToIndexedDB(storeName,addedPokemon);
})
.catch(error => console.log('error', error));
}