Merge branch 'main' into feat/debugmode
This commit is contained in:
15
src/app/api/komga/cache/clear/route.ts
vendored
15
src/app/api/komga/cache/clear/route.ts
vendored
@@ -1,15 +1,8 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { serverCacheService } from "@/lib/services/server-cache.service";
|
||||
import { getServerCacheService } from "@/lib/services/server-cache.service";
|
||||
|
||||
export async function POST() {
|
||||
try {
|
||||
serverCacheService.clear();
|
||||
return NextResponse.json({ message: "Cache serveur supprimé avec succès" });
|
||||
} catch (error) {
|
||||
console.error("Erreur lors de la suppression du cache serveur:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Erreur lors de la suppression du cache serveur" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
const cacheService = await getServerCacheService();
|
||||
cacheService.clear();
|
||||
return NextResponse.json({ message: "Cache cleared" });
|
||||
}
|
||||
|
||||
10
src/app/api/komga/cache/mode/route.ts
vendored
10
src/app/api/komga/cache/mode/route.ts
vendored
@@ -1,8 +1,9 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { serverCacheService } from "@/lib/services/server-cache.service";
|
||||
import { getServerCacheService } from "@/lib/services/server-cache.service";
|
||||
|
||||
export async function GET() {
|
||||
return NextResponse.json({ mode: serverCacheService.getCacheMode() });
|
||||
const cacheService = await getServerCacheService();
|
||||
return NextResponse.json({ mode: cacheService.getCacheMode() });
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
@@ -15,8 +16,9 @@ export async function POST(request: Request) {
|
||||
);
|
||||
}
|
||||
|
||||
serverCacheService.setCacheMode(mode);
|
||||
return NextResponse.json({ mode: serverCacheService.getCacheMode() });
|
||||
const cacheService = await getServerCacheService();
|
||||
cacheService.setCacheMode(mode);
|
||||
return NextResponse.json({ mode: cacheService.getCacheMode() });
|
||||
} catch (error) {
|
||||
console.error("Erreur lors de la mise à jour du mode de cache:", error);
|
||||
return NextResponse.json({ error: "Invalid request" }, { status: 400 });
|
||||
|
||||
@@ -16,7 +16,7 @@ async function refreshLibrary(libraryId: string) {
|
||||
"use server";
|
||||
|
||||
try {
|
||||
await LibraryService.clearLibrarySeriesCache(libraryId);
|
||||
await LibraryService.invalidateLibrarySeriesCache(libraryId);
|
||||
|
||||
revalidatePath(`/libraries/${libraryId}`);
|
||||
return { success: true };
|
||||
|
||||
@@ -8,7 +8,7 @@ async function refreshHome() {
|
||||
"use server";
|
||||
|
||||
try {
|
||||
await HomeService.clearHomeCache();
|
||||
await HomeService.invalidateHomeCache();
|
||||
revalidatePath("/");
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
|
||||
@@ -29,8 +29,8 @@ async function refreshSeries(seriesId: string) {
|
||||
"use server";
|
||||
|
||||
try {
|
||||
await SeriesService.clearSeriesBooksCache(seriesId);
|
||||
await SeriesService.clearSeriesCache(seriesId);
|
||||
await SeriesService.invalidateSeriesBooksCache(seriesId);
|
||||
await SeriesService.invalidateSeriesCache(seriesId);
|
||||
revalidatePath(`/series/${seriesId}`);
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user