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