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
+25
View File
@@ -62,4 +62,29 @@ function loadFromIndexedDB(storeName) {
};
}
);
}
function ReadFromApi(storename){
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://633bde0df11701a65f69abe8.mockapi.io/api/v1/"+storename+"/", requestOptions)
.then(response => response.text())
.then(result => {
let pokemons = JSON.parse(result);
console.log(pokemons)
})
.catch(error => console.log('error', error));
}
function DeleteFromApi(storeName,id) {
var requestOptions = {
method: 'DELETE',
redirect: 'follow'
};
fetch("https://633bde0df11701a65f69abe8.mockapi.io/api/v1/"+storeName+"/"+id, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
}