From c14da716f5a3376a351847dfedb61dd13e19ae61 Mon Sep 17 00:00:00 2001 From: Fauvet Matthis Date: Fri, 21 Jun 2024 17:59:14 +0200 Subject: [PATCH] modified code --- onzer.riot | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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(); });