feat: implement DELETE API endpoint for cache invalidation in HomeService and update ClientHomePage to utilize it
This commit is contained in:
@@ -36,3 +36,34 @@ export async function GET() {
|
||||
}
|
||||
}
|
||||
|
||||
export async function DELETE() {
|
||||
try {
|
||||
await HomeService.invalidateHomeCache();
|
||||
return NextResponse.json({ success: true });
|
||||
} catch (error) {
|
||||
console.error("API Home - Erreur lors de l'invalidation du cache:", error);
|
||||
if (error instanceof AppError) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: {
|
||||
code: error.code,
|
||||
name: "Cache invalidation error",
|
||||
message: getErrorMessage(error.code),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: {
|
||||
code: ERROR_CODES.CACHE.DELETE_ERROR,
|
||||
name: "Cache invalidation error",
|
||||
message: getErrorMessage(ERROR_CODES.CACHE.DELETE_ERROR),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ import { ClientLibraryPage } from "./ClientLibraryPage";
|
||||
import type { UserPreferences } from "@/types/preferences";
|
||||
|
||||
interface PageProps {
|
||||
params: { libraryId: string };
|
||||
searchParams: { page?: string; unread?: string; search?: string; size?: string };
|
||||
params: Promise<{ libraryId: string }>;
|
||||
searchParams: Promise<{ page?: string; unread?: string; search?: string; size?: string }>;
|
||||
}
|
||||
|
||||
export default async function LibraryPage({ params, searchParams }: PageProps) {
|
||||
|
||||
@@ -3,10 +3,10 @@ import { LoginContent } from "./LoginContent";
|
||||
import { withPageTiming } from "@/lib/hoc/withPageTiming";
|
||||
|
||||
interface PageProps {
|
||||
searchParams: {
|
||||
searchParams: Promise<{
|
||||
from?: string;
|
||||
tab?: string;
|
||||
};
|
||||
}>;
|
||||
}
|
||||
export const metadata: Metadata = {
|
||||
title: "Connexion",
|
||||
|
||||
@@ -3,8 +3,8 @@ import { ClientSeriesPage } from "./ClientSeriesPage";
|
||||
import type { UserPreferences } from "@/types/preferences";
|
||||
|
||||
interface PageProps {
|
||||
params: { seriesId: string };
|
||||
searchParams: { page?: string; unread?: string; size?: string };
|
||||
params: Promise<{ seriesId: string }>;
|
||||
searchParams: Promise<{ page?: string; unread?: string; size?: string }>;
|
||||
}
|
||||
|
||||
export default async function SeriesPage({ params, searchParams }: PageProps) {
|
||||
|
||||
Reference in New Issue
Block a user