feat: debugmode full request
This commit is contained in:
30
src/app/api/debug/route.ts
Normal file
30
src/app/api/debug/route.ts
Normal file
@@ -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 });
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<PageHeader title="Téléchargements" description="Gérez vos livres disponibles hors ligne" />
|
||||
@@ -9,3 +10,5 @@ export default function DownloadsPage() {
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default withPageTiming("DownloadsPage", DownloadsPage);
|
||||
|
||||
@@ -3,6 +3,8 @@ import { Inter } from "next/font/google";
|
||||
import "@/styles/globals.css";
|
||||
import { cn } from "@/lib/utils";
|
||||
import ClientLayout from "@/components/layout/ClientLayout";
|
||||
import { PreferencesProvider } from "@/contexts/PreferencesContext";
|
||||
import { DebugWrapper } from "@/components/debug/DebugWrapper";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
@@ -113,7 +115,10 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
||||
/>
|
||||
</head>
|
||||
<body className={cn("min-h-screen bg-background font-sans antialiased", inter.className)}>
|
||||
<ClientLayout>{children}</ClientLayout>
|
||||
<PreferencesProvider>
|
||||
<ClientLayout>{children}</ClientLayout>
|
||||
<DebugWrapper />
|
||||
</PreferencesProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@ import { LibraryService } from "@/lib/services/library.service";
|
||||
import { PreferencesService } from "@/lib/services/preferences.service";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { RefreshButton } from "@/components/library/RefreshButton";
|
||||
import { withPageTiming } from "@/lib/hoc/withPageTiming";
|
||||
|
||||
interface PageProps {
|
||||
params: { libraryId: string };
|
||||
@@ -49,7 +50,7 @@ async function getLibrarySeries(
|
||||
}
|
||||
}
|
||||
|
||||
export default async function LibraryPage({ params, searchParams }: PageProps) {
|
||||
async function LibraryPage({ params, searchParams }: PageProps) {
|
||||
const currentPage = searchParams.page ? parseInt(searchParams.page) : 1;
|
||||
const preferences = await PreferencesService.getPreferences();
|
||||
|
||||
@@ -105,3 +106,5 @@ export default async function LibraryPage({ params, searchParams }: PageProps) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default withPageTiming("LibraryPage", LibraryPage);
|
||||
|
||||
22
src/app/libraries/page.tsx
Normal file
22
src/app/libraries/page.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { LibrariesContent } from "@/components/libraries/LibrariesContent";
|
||||
import { LibraryService } from "@/lib/services/library.service";
|
||||
import { withPageTiming } from "@/lib/hoc/withPageTiming";
|
||||
|
||||
async function LibrariesPage() {
|
||||
try {
|
||||
const libraries = await LibraryService.getLibraries();
|
||||
return <LibrariesContent libraries={libraries} />;
|
||||
} catch (error) {
|
||||
return (
|
||||
<main className="container mx-auto px-4 py-8">
|
||||
<div className="rounded-md bg-destructive/15 p-4">
|
||||
<p className="text-sm text-destructive">
|
||||
{error instanceof Error ? error.message : "Une erreur est survenue"}
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default withPageTiming("LibrariesPage", LibrariesPage);
|
||||
@@ -2,6 +2,7 @@ import { HomeContent } from "@/components/home/HomeContent";
|
||||
import { HomeService } from "@/lib/services/home.service";
|
||||
import { redirect } from "next/navigation";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { withPageTiming } from "@/lib/hoc/withPageTiming";
|
||||
|
||||
async function refreshHome() {
|
||||
"use server";
|
||||
@@ -16,7 +17,7 @@ async function refreshHome() {
|
||||
}
|
||||
}
|
||||
|
||||
export default async function HomePage() {
|
||||
async function HomePage() {
|
||||
try {
|
||||
const data = await HomeService.getHomeData();
|
||||
|
||||
@@ -38,3 +39,5 @@ export default async function HomePage() {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default withPageTiming("HomePage", HomePage);
|
||||
|
||||
@@ -3,6 +3,7 @@ import { SeriesHeader } from "@/components/series/SeriesHeader";
|
||||
import { SeriesService } from "@/lib/services/series.service";
|
||||
import { PreferencesService } from "@/lib/services/preferences.service";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { withPageTiming } from "@/lib/hoc/withPageTiming";
|
||||
|
||||
interface PageProps {
|
||||
params: { seriesId: string };
|
||||
@@ -38,7 +39,7 @@ async function refreshSeries(seriesId: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export default async function SeriesPage({ params, searchParams }: PageProps) {
|
||||
async function SeriesPage({ params, searchParams }: PageProps) {
|
||||
const currentPage = searchParams.page ? parseInt(searchParams.page) : 1;
|
||||
const preferences = await PreferencesService.getPreferences();
|
||||
|
||||
@@ -76,3 +77,5 @@ export default async function SeriesPage({ params, searchParams }: PageProps) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default withPageTiming("SeriesPage", SeriesPage);
|
||||
|
||||
Reference in New Issue
Block a user