feat(i18n): first shoot on translated errors

This commit is contained in:
Julien Froidefond
2025-02-27 15:05:44 +01:00
parent 41228e59bc
commit ea51ff53a9
14 changed files with 54 additions and 38 deletions

View File

@@ -8,6 +8,8 @@ import { ErrorMessage } from "@/components/ui/ErrorMessage";
import { LibraryResponse } from "@/types/library";
import { KomgaSeries, KomgaLibrary } from "@/types/komga";
import { UserPreferences } from "@/types/preferences";
import { ERROR_CODES } from "@/constants/errorCodes";
interface PageProps {
params: { libraryId: string };
searchParams: { page?: string; unread?: string; search?: string };
@@ -90,17 +92,20 @@ async function LibraryPage({ params, searchParams }: PageProps) {
</div>
);
} catch (error) {
if (error instanceof Error) {
return (
<div className="container py-8 space-y-8">
<div className="flex items-center justify-between">
<h1 className="text-3xl font-bold">Séries</h1>
<RefreshButton libraryId={params.libraryId} refreshLibrary={refreshLibrary} />
</div>
<ErrorMessage errorCode="SERIES_FETCH_ERROR" />
</div>
);
}
return (
<div className="container py-8 space-y-8">
<div className="flex items-center justify-between">
<h1 className="text-3xl font-bold">Séries</h1>
<RefreshButton libraryId={params.libraryId} refreshLibrary={refreshLibrary} />
</div>
<ErrorMessage
message={
error instanceof Error ? error.message : "Erreur lors de la récupération des séries"
}
/>
<ErrorMessage errorCode="SERIES_FETCH_ERROR" />
</div>
);
}