feat: local store read progress for later sync

This commit is contained in:
Julien Froidefond
2025-03-01 11:37:34 +01:00
parent 13492cea84
commit a3d0094cec
11 changed files with 93 additions and 43 deletions

View File

@@ -3,6 +3,7 @@
import { KomgaBook } from "@/types/komga";
import { BookReader } from "./BookReader";
import { useRouter } from "next/navigation";
import { ClientOfflineBookService } from "@/lib/services/client-offlinebook.service";
interface ClientBookWrapperProps {
book: KomgaBook;
@@ -12,10 +13,11 @@ interface ClientBookWrapperProps {
export function ClientBookWrapper({ book, pages }: ClientBookWrapperProps) {
const router = useRouter();
const handleCloseReader = () => {
const handleCloseReader = (currentPage: number) => {
fetch(`/api/komga/cache/clear/${book.libraryId}/${book.seriesId}`, {
method: "POST",
});
ClientOfflineBookService.setCurrentPage(book, currentPage);
router.back();
};