modified code
This commit is contained in:
parent
7beea56d6e
commit
c14da716f5
15
onzer.riot
15
onzer.riot
@ -11,7 +11,7 @@
|
|||||||
<form onsubmit={ add }>
|
<form onsubmit={ add }>
|
||||||
<div class="flex flex-row items-baseline">
|
<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"
|
<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"
|
<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"/>
|
class="ml-2 border-solid bg-emerald-300 border rounded-lg border-emerald-600 mb-4 h-20 w-48 mt-2"/>
|
||||||
</div>
|
</div>
|
||||||
@ -45,8 +45,8 @@
|
|||||||
},
|
},
|
||||||
click(e) {
|
click(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
this.paintButton();
|
this.paintButton();
|
||||||
const old_search = this.state.search;
|
|
||||||
switch(e.target.value){
|
switch(e.target.value){
|
||||||
case "Albums":
|
case "Albums":
|
||||||
this.state.placeholder = "Rechercher dans les albums";
|
this.state.placeholder = "Rechercher dans les albums";
|
||||||
@ -59,22 +59,19 @@
|
|||||||
this.state.search = "artists";
|
this.state.search = "artists";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.placeholder = "Rechercher dans les songs";
|
this.state.placeholder = "Rechercher dans les songs";
|
||||||
this.song_style = "isActivate";
|
this.song_style = "isActivate";
|
||||||
this.state.search = "songs";
|
this.state.search = "songs";
|
||||||
}
|
}
|
||||||
/*if(old_search != this.state.search){
|
|
||||||
this.list();
|
|
||||||
}*/
|
|
||||||
this.update();
|
this.update();
|
||||||
},
|
},
|
||||||
async list(){
|
async fetchData(){
|
||||||
let data = await this.fetchData();
|
let data = await this.execQuery();
|
||||||
this.state = {
|
this.state = {
|
||||||
items: data.results
|
items: data.results
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
fetchData(){
|
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 => {
|
||||||
return response.json();
|
return response.json();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user