diff --git a/.gitignore b/.gitignore
index cbb590b..a538ba3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,6 +37,7 @@ next-env.d.ts
.vscode
.cache
+debug-logs
# Environment variables
.env
diff --git a/src/app/api/debug/route.ts b/src/app/api/debug/route.ts
new file mode 100644
index 0000000..a88daec
--- /dev/null
+++ b/src/app/api/debug/route.ts
@@ -0,0 +1,30 @@
+import { NextRequest, NextResponse } from "next/server";
+import { DebugService } from "@/lib/services/debug.service";
+
+export async function GET() {
+ try {
+ const logs = await DebugService.getRequestLogs();
+ return NextResponse.json(logs);
+ } catch (error) {
+ return NextResponse.json({ error: "Erreur lors de la récupération des logs" }, { status: 500 });
+ }
+}
+
+export async function POST(request: NextRequest) {
+ try {
+ const timing = await request.json();
+ await DebugService.logRequest(timing);
+ return NextResponse.json({ success: true });
+ } catch (error) {
+ return NextResponse.json({ error: "Erreur lors de l'enregistrement du log" }, { status: 500 });
+ }
+}
+
+export async function DELETE() {
+ try {
+ await DebugService.clearLogs();
+ return NextResponse.json({ success: true });
+ } catch (error) {
+ return NextResponse.json({ error: "Erreur lors de la suppression des logs" }, { status: 500 });
+ }
+}
diff --git a/src/app/books/[bookId]/page.tsx b/src/app/books/[bookId]/page.tsx
index f9f103d..0e20446 100644
--- a/src/app/books/[bookId]/page.tsx
+++ b/src/app/books/[bookId]/page.tsx
@@ -3,8 +3,9 @@ import { ClientBookWrapper } from "@/components/reader/ClientBookWrapper";
import { BookSkeleton } from "@/components/skeletons/BookSkeleton";
import { BookService } from "@/lib/services/book.service";
import { notFound } from "next/navigation";
+import { withPageTiming } from "@/lib/hoc/withPageTiming";
-export default async function BookPage({ params }: { params: { bookId: string } }) {
+async function BookPage({ params }: { params: { bookId: string } }) {
try {
const data = await BookService.getBook(params.bookId);
@@ -18,3 +19,5 @@ export default async function BookPage({ params }: { params: { bookId: string }
notFound();
}
}
+
+export default withPageTiming("BookPage", BookPage);
diff --git a/src/app/downloads/page.tsx b/src/app/downloads/page.tsx
index 71dc642..5fdfcc0 100644
--- a/src/app/downloads/page.tsx
+++ b/src/app/downloads/page.tsx
@@ -1,7 +1,8 @@
import { PageHeader } from "@/components/layout/PageHeader";
import { DownloadManager } from "@/components/downloads/DownloadManager";
+import { withPageTiming } from "@/lib/hoc/withPageTiming";
-export default function DownloadsPage() {
+function DownloadsPage() {
return (
<>