refactor: remove unused home GET API route

This commit is contained in:
2026-02-28 12:14:28 +01:00
parent b1e0e18d9e
commit 70a77481e5
2 changed files with 1 additions and 40 deletions

View File

@@ -1,39 +0,0 @@
import { NextResponse } from "next/server";
import { HomeService } from "@/lib/services/home.service";
import { ERROR_CODES } from "@/constants/errorCodes";
import { AppError } from "@/utils/errors";
import { getErrorMessage } from "@/utils/errors";
import logger from "@/lib/logger";
// Cache handled in service via fetchFromApi options
export async function GET() {
try {
const data = await HomeService.getHomeData();
return NextResponse.json(data);
} catch (error) {
logger.error({ err: error }, "API Home - Erreur:");
if (error instanceof AppError) {
return NextResponse.json(
{
error: {
code: error.code,
name: "Home data fetch error",
message: getErrorMessage(error.code),
},
},
{ status: error.code === ERROR_CODES.KOMGA.MISSING_CONFIG ? 404 : 500 }
);
}
return NextResponse.json(
{
error: {
code: ERROR_CODES.KOMGA.SERVER_UNREACHABLE,
name: "Home data fetch error",
message: getErrorMessage(ERROR_CODES.KOMGA.SERVER_UNREACHABLE),
},
},
{ status: 500 }
);
}
}