- AdditionnalData for buttons
- refresh manga metadata and chapters
This commit is contained in:
Jérémy Guillot
2024-07-05 19:03:16 +02:00
parent 3012adfee7
commit 586ebdb126
14 changed files with 283 additions and 107 deletions

View File

@@ -9,8 +9,32 @@ export default class extends Controller {
currentStatus: String
}
refreshMetadata() {
console.log("Refreshing...");
refreshMetadata(event) {
const mangaId = event.currentTarget.dataset.mangaid;
const url = `/refresh_metadata`;
fetch(url, {
method: 'POST',
headers: {
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'application/json',
},
body: JSON.stringify({ mangaId: mangaId })
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
console.log('Metadata refreshed:', data);
// Traitez la réponse ici, par exemple en mettant à jour l'interface utilisateur
})
.catch(error => {
console.error('Error:', error);
// Gérez l'erreur ici, par exemple en affichant un message à l'utilisateur
});
}
searchLastChapter() {