test route
This commit is contained in:
parent
286e660f63
commit
0ce0fe7109
35
onzer.riot
35
onzer.riot
@ -24,7 +24,6 @@
|
|||||||
style={ state.search === 'songs' ? 'width: 100%;' : '' }>
|
style={ state.search === 'songs' ? 'width: 100%;' : '' }>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<p>{ item.name }</p>
|
<p>{ item.name }</p>
|
||||||
<button if={ state.search === 'songs' } onclick={ () => addSong(item) } class="add-button">Ajouter</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -39,14 +38,6 @@
|
|||||||
<button onclick={nextPage} disabled={state.page === state.totalPages}>Next</button>
|
<button onclick={nextPage} disabled={state.page === state.totalPages}>Next</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Modal pour le formulaire de création de playlist -->
|
|
||||||
<div class="modal" if={ state.showModal }>
|
|
||||||
<div class="modal-content">
|
|
||||||
<span class="close" onclick={ closeModal }>×</span>
|
|
||||||
<playlist-form></playlist-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
riot.compile().then(() => {
|
riot.compile().then(() => {
|
||||||
riot.mount('playlist-form');
|
riot.mount('playlist-form');
|
||||||
@ -104,19 +95,6 @@
|
|||||||
this.state.totalPages = Math.ceil((data.results || []).length / 9);
|
this.state.totalPages = Math.ceil((data.results || []).length / 9);
|
||||||
this.update();
|
this.update();
|
||||||
},
|
},
|
||||||
async fetchPlaylists() {
|
|
||||||
try {
|
|
||||||
const response = await fetch('https://dwarves.iut-fbleau.fr/~fauvet/api/playlists');
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error('Network response was not ok');
|
|
||||||
}
|
|
||||||
const data = await response.json();
|
|
||||||
console.log('Playlists:', data);
|
|
||||||
// Utilisez les données des playlists comme nécessaire ici
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching playlists:', error);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
paintButton(){
|
paintButton(){
|
||||||
this.album_style = "isDeactivate";
|
this.album_style = "isDeactivate";
|
||||||
this.artist_style = "isDeactivate";
|
this.artist_style = "isDeactivate";
|
||||||
@ -139,19 +117,6 @@
|
|||||||
computeHttpRequest = baseHttpRequest + table;
|
computeHttpRequest = baseHttpRequest + table;
|
||||||
}
|
}
|
||||||
return fetch(computeHttpRequest).then(response => response.json());
|
return fetch(computeHttpRequest).then(response => response.json());
|
||||||
},
|
|
||||||
openModal() {
|
|
||||||
this.state.showModal = true;
|
|
||||||
this.update();
|
|
||||||
},
|
|
||||||
closeModal() {
|
|
||||||
this.state.showModal = false;
|
|
||||||
this.update();
|
|
||||||
},
|
|
||||||
addSong(item) {
|
|
||||||
console.log("Ajouter le titre:", item);
|
|
||||||
// Ajoutez ici le code pour gérer l'ajout du titre à une playlist ou une autre action
|
|
||||||
this.openModal(); // Appel à openModal pour ouvrir le modal
|
|
||||||
},
|
},
|
||||||
prevPage() {
|
prevPage() {
|
||||||
if (this.state.page > 1) {
|
if (this.state.page > 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user