Added:
- AdditionnalData for buttons - refresh manga metadata and chapters
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user