modified code

This commit is contained in:
Matthis FAUVET 2024-06-21 14:48:38 +02:00
parent 7e2bb9a22e
commit 7460ef7905
2 changed files with 13 additions and 10 deletions

View File

@ -16,16 +16,18 @@
<script type="javascript" src="./onzer.riot"></script> <script type="javascript" src="./onzer.riot"></script>
<script type="text/javascript"> <script type="text/javascript">
async function fetch_data(){ function fetch_data(){
return fetch("https://dwarves.iut-fbleau.fr/~fauvet/api/albums").then(response => { return fetch("https://dwarves.iut-fbleau.fr/~fauvet/api/albums").then(response => {
return response.json(); return response.json();
} ) } )
} }
riot.compile().then(() => { async function wait_data(){
riot.mount('onzer', { return await this.fetch_data()
items : await fetch_data()
} }
riot.compile().then(() => {
riot.mount('onzer', {items: wait_data()}
); );
}) })
</script> </script>

View File

@ -32,6 +32,7 @@
onBeforeMount(props){ onBeforeMount(props){
this.state = { this.state = {
placeholder: "Rechercher dans les albums", placeholder: "Rechercher dans les albums",
items: props.results,
search: "albums" search: "albums"
}; };
this.paintButton(); this.paintButton();