try to update items list

This commit is contained in:
Matthis FAUVET 2024-06-21 18:37:33 +02:00
parent d3c7ba896e
commit da90479b2b

View File

@ -35,7 +35,6 @@
}; };
this.paintButton(); this.paintButton();
this.album_style = "isActivate"; this.album_style = "isActivate";
this.update();
}, },
onMounted(){ onMounted(){
this.update(); this.update();
@ -45,7 +44,6 @@
}, },
click(e) { click(e) {
e.preventDefault(); e.preventDefault();
this.paintButton(); this.paintButton();
switch(e.target.value){ switch(e.target.value){
case "Albums": case "Albums":
@ -63,19 +61,14 @@
this.song_style = "isActivate"; this.song_style = "isActivate";
this.state.search = "songs"; this.state.search = "songs";
} }
this.fetchData(e) this.fetchData()
this.update(); this.update();
}, },
async fetchData(event){ async fetchData(){
event.preventDefault();
let data = await this.execQuery(); let data = await this.execQuery();
console.log(this.state.search); this.update({
console.log(data.results);
this.state = {
items: data.results items: data.results
}; });
console.log(this.state.items);
this.update();
}, },
execQuery(){ execQuery(){
return fetch("https://dwarves.iut-fbleau.fr/~fauvet/api/"+this.state.search).then(response => { return fetch("https://dwarves.iut-fbleau.fr/~fauvet/api/"+this.state.search).then(response => {
@ -87,7 +80,6 @@
this.artist_style = "isDeactivate"; this.artist_style = "isDeactivate";
this.song_style = "isDeactivate"; this.song_style = "isDeactivate";
} }
} }
</script> </script>
<style> <style>