refactor: remove HTTP Cache-Control headers and revalidate settings from API routes to streamline caching strategy and avoid conflicts with server-side caching

This commit is contained in:
Julien Froidefond
2025-12-07 11:36:50 +01:00
parent c4ae6a1b2f
commit c76d960dca
5 changed files with 6 additions and 27 deletions

View File

@@ -4,7 +4,6 @@ import { ERROR_CODES } from "@/constants/errorCodes";
import { AppError } from "@/utils/errors";
import { getErrorMessage } from "@/utils/errors";
import logger from "@/lib/logger";
export const revalidate = 60;
export async function GET() {
try {

View File

@@ -5,7 +5,6 @@ import { AppError } from "@/utils/errors";
import { getErrorMessage } from "@/utils/errors";
import type { NextRequest } from "next/server";
import logger from "@/lib/logger";
export const revalidate = 60;
const DEFAULT_PAGE_SIZE = 20;
@@ -27,14 +26,7 @@ export async function GET(
LibraryService.getLibrary(libraryId),
]);
return NextResponse.json(
{ series, library },
{
headers: {
"Cache-Control": "public, s-maxage=60, stale-while-revalidate=120",
},
}
);
return NextResponse.json({ series, library });
} catch (error) {
logger.error({ err: error }, "API Library Series - Erreur:");
if (error instanceof AppError) {

View File

@@ -5,7 +5,6 @@ import { AppError } from "@/utils/errors";
import { getErrorMessage } from "@/utils/errors";
import type { NextRequest } from "next/server";
import logger from "@/lib/logger";
export const revalidate = 60;
const DEFAULT_PAGE_SIZE = 20;
@@ -26,14 +25,7 @@ export async function GET(
SeriesService.getSeries(seriesId),
]);
return NextResponse.json(
{ books, series },
{
headers: {
"Cache-Control": "public, s-maxage=60, stale-while-revalidate=120",
},
}
);
return NextResponse.json({ books, series });
} catch (error) {
logger.error({ err: error }, "API Series Books - Erreur:");
if (error instanceof AppError) {

View File

@@ -6,7 +6,6 @@ import type { KomgaSeries } from "@/types/komga";
import { getErrorMessage } from "@/utils/errors";
import type { NextRequest } from "next/server";
import logger from "@/lib/logger";
export const revalidate = 60;
export async function GET(
request: NextRequest,
@@ -16,11 +15,7 @@ export async function GET(
const seriesId: string = (await params).seriesId;
const series: KomgaSeries = await SeriesService.getSeries(seriesId);
return NextResponse.json(series, {
headers: {
"Cache-Control": "public, s-maxage=60, stale-while-revalidate=120",
},
});
return NextResponse.json(series);
} catch (error) {
logger.error({ err: error }, "API Series - Erreur:");
if (error instanceof AppError) {