diff --git a/onzer.riot b/onzer.riot index 358a9ba..babe3c4 100644 --- a/onzer.riot +++ b/onzer.riot @@ -11,7 +11,7 @@
+ placeholder={ state.placeholder } onkeyup={ edit } />
@@ -45,8 +45,8 @@ }, click(e) { e.preventDefault(); + this.paintButton(); - const old_search = this.state.search; switch(e.target.value){ case "Albums": this.state.placeholder = "Rechercher dans les albums"; @@ -59,22 +59,19 @@ this.state.search = "artists"; break; default: - this.placeholder = "Rechercher dans les songs"; + this.state.placeholder = "Rechercher dans les songs"; this.song_style = "isActivate"; this.state.search = "songs"; } - /*if(old_search != this.state.search){ - this.list(); - }*/ this.update(); }, - async list(){ - let data = await this.fetchData(); + async fetchData(){ + let data = await this.execQuery(); this.state = { items: data.results }; }, - fetchData(){ + execQuery(){ return fetch("https://dwarves.iut-fbleau.fr/~fauvet/api/"+this.state.search).then(response => { return response.json(); });