modified code
This commit is contained in:
parent
7beea56d6e
commit
c14da716f5
15
onzer.riot
15
onzer.riot
@ -11,7 +11,7 @@
|
||||
<form onsubmit={ add }>
|
||||
<div class="flex flex-row items-baseline">
|
||||
<input class="flex-grow-1 border-solid border bg-emerald-100 w-half rounded-lg border-emerald-300 border h-20 pl-6 grow"
|
||||
placeholder={ this.state.placeholder } onkeyup={ edit } />
|
||||
placeholder={ state.placeholder } onkeyup={ edit } />
|
||||
<input type="button" value="Playlists"
|
||||
class="ml-2 border-solid bg-emerald-300 border rounded-lg border-emerald-600 mb-4 h-20 w-48 mt-2"/>
|
||||
</div>
|
||||
@ -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();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user