feat: ajout de la fonctionnalité de suppression des chapitres avec mise à jour de l'API et des composants associés pour gérer la suppression des chapitres et des fichiers CBZ.
This commit is contained in:
parent
37e1b202c2
commit
8692fa14c6
@@ -197,6 +197,18 @@ export const useMangaStore = defineStore('manga', {
|
||||
console.error('Erreur lors de la recherche du chapitre:', error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
// --- Delete Chapter Action ---
|
||||
async deleteChapter(chapterId) {
|
||||
try {
|
||||
await mangaRepository.deleteChapter(chapterId);
|
||||
// Mettre à jour l'état du chapitre pour refléter qu'il n'est plus disponible
|
||||
this.updateChapterAvailability(chapterId, false);
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la suppression du chapitre:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -173,4 +173,19 @@ export class ApiMangaRepository {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async deleteChapter(chapterId) {
|
||||
try {
|
||||
const response = await fetch(`/api/manga/chapters/${chapterId}/cbz`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to delete chapter');
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('API Error:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
|
||||
<script setup>
|
||||
import { ArrowDownTrayIcon, MagnifyingGlassIcon, TrashIcon, XMarkIcon } from '@heroicons/vue/24/solid';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useMangaStore } from '../../application/store/mangaStore';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useMangaStore } from '../../application/store/mangaStore';
|
||||
|
||||
const props = defineProps({
|
||||
chapter: {
|
||||
@@ -87,8 +87,12 @@
|
||||
};
|
||||
|
||||
const handleDelete = async () => {
|
||||
// TODO: Implémenter la suppression du chapitre
|
||||
console.log('Suppression du chapitre:', props.chapter.id);
|
||||
try {
|
||||
console.log(`MangaChapter: Suppression du chapitre ${props.chapter.number} (ID: ${props.chapter.id})`);
|
||||
await store.deleteChapter(props.chapter.id);
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la suppression du chapitre:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDownload = async () => {
|
||||
|
||||
Reference in New Issue
Block a user