From 0ee3b9fdd1981a1a360c0d105ade28eb49de5d4e Mon Sep 17 00:00:00 2001 From: Fauvet Matthis Date: Fri, 21 Jun 2024 01:35:24 +0200 Subject: [PATCH] clean code --- onzer.riot | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/onzer.riot b/onzer.riot index 55686c6..f5ba899 100644 --- a/onzer.riot +++ b/onzer.riot @@ -18,15 +18,14 @@ export default { async onBeforeMount(props){ this.state.placeholder = 'Rechercher dans les albums'; + this.fetchSong(); }, edit(e) { }, click(e) { e.preventDefault(); - this.clearButton(); - switch (e.target.attributes.value.value) { case 'Songs': this.state.placeholder = "Rechercher dans les songs" @@ -52,6 +51,12 @@ document.getElementById("album").style.borderColor = "#6EE7B7"; document.getElementById("artist").style.backgroundColor = "#D1FAE5"; document.getElementById("artist").style.borderColor = "#6EE7B7"; + }, + async fetchSong(){ + return fetch("https://dwarves.iut-fbleau.fr/~fauvet/api/songs").then(response => { + console.log(response.json()); + }); + } }