diff --git a/src/app/api/komga/cache/clear/[libraryId]/[seriesId]/route.ts b/src/app/api/komga/cache/clear/[libraryId]/[seriesId]/route.ts index 34e8d06..86c5a44 100644 --- a/src/app/api/komga/cache/clear/[libraryId]/[seriesId]/route.ts +++ b/src/app/api/komga/cache/clear/[libraryId]/[seriesId]/route.ts @@ -4,6 +4,7 @@ import { getErrorMessage } from "@/utils/errors"; import { LibraryService } from "@/lib/services/library.service"; import { HomeService } from "@/lib/services/home.service"; import { SeriesService } from "@/lib/services/series.service"; +import { revalidatePath } from "next/cache"; export async function POST( request: Request, @@ -13,13 +14,17 @@ export async function POST( const { libraryId, seriesId } = params; await HomeService.invalidateHomeCache(); + revalidatePath("/"); if (libraryId) { await LibraryService.invalidateLibrarySeriesCache(libraryId); + revalidatePath(`/library/${libraryId}`); } + if (seriesId) { await SeriesService.invalidateSeriesBooksCache(seriesId); await SeriesService.invalidateSeriesCache(seriesId); + revalidatePath(`/series/${seriesId}`); } return NextResponse.json({ message: "🧹 Cache vidé avec succès" }); diff --git a/src/components/home/MediaRow.tsx b/src/components/home/MediaRow.tsx index de04f2c..d48fc08 100644 --- a/src/components/home/MediaRow.tsx +++ b/src/components/home/MediaRow.tsx @@ -4,6 +4,8 @@ import { ChevronLeft, ChevronRight } from "lucide-react"; import { useRef, useState } from "react"; import { Cover } from "@/components/ui/cover"; import { useRouter } from "next/navigation"; +import { ClientOfflineBookService } from "@/lib/services/client-offlinebook.service"; +import { KomgaBook } from "@/types/komga"; interface BaseItem { id: string; @@ -18,12 +20,12 @@ interface OptimizedSeries extends BaseItem { } interface OptimizedBook extends BaseItem { - readProgress:{ - page: number - } + readProgress: { + page: number; + }; media: { pagesCount: number; - } + }; metadata: { title: string; number?: string; @@ -124,19 +126,27 @@ function MediaCard({ item, onClick }: MediaCardProps) { onClick={onClick} className="flex-shrink-0 w-[200px] relative flex flex-col rounded-lg border bg-card text-card-foreground shadow-sm hover:bg-accent hover:text-accent-foreground transition-colors overflow-hidden cursor-pointer" > - {/* Image de couverture */}