diff --git a/src/components/ui/mark-as-unread-button.tsx b/src/components/ui/mark-as-unread-button.tsx index 941a602..9c90750 100644 --- a/src/components/ui/mark-as-unread-button.tsx +++ b/src/components/ui/mark-as-unread-button.tsx @@ -22,7 +22,6 @@ export function MarkAsUnreadButton({ bookId, onSuccess, className }: MarkAsUnrea e.stopPropagation(); // Empêcher la propagation au parent setIsLoading(true); try { - ClientOfflineBookService.removeCurrentPageById(bookId); const response = await fetch(`/api/komga/books/${bookId}/read-progress`, { method: "DELETE", }); @@ -31,6 +30,9 @@ export function MarkAsUnreadButton({ bookId, onSuccess, className }: MarkAsUnrea throw new Error(t("books.actions.markAsUnread.error.update")); } + // On supprime la page courante du localStorage seulement après que l'API a répondu + ClientOfflineBookService.removeCurrentPageById(bookId); + toast({ title: t("books.actions.markAsUnread.success.title"), description: t("books.actions.markAsUnread.success.description"),