refacto : komgaServiceConfig unused
This commit is contained in:
@@ -12,8 +12,6 @@ const PAGE_SIZE = 20;
|
|||||||
|
|
||||||
async function getLibrarySeries(libraryId: string, page: number = 1, unreadOnly: boolean = false) {
|
async function getLibrarySeries(libraryId: string, page: number = 1, unreadOnly: boolean = false) {
|
||||||
try {
|
try {
|
||||||
const cookiesStore = cookies();
|
|
||||||
const config = komgaConfigService.validateAndGetConfig(cookiesStore);
|
|
||||||
const pageIndex = page - 1;
|
const pageIndex = page - 1;
|
||||||
|
|
||||||
const series = await LibraryService.getLibrarySeries(
|
const series = await LibraryService.getLibrarySeries(
|
||||||
@@ -23,7 +21,7 @@ async function getLibrarySeries(libraryId: string, page: number = 1, unreadOnly:
|
|||||||
unreadOnly
|
unreadOnly
|
||||||
);
|
);
|
||||||
|
|
||||||
return { data: series, serverUrl: config.serverUrl };
|
return { data: series };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error instanceof Error ? error : new Error("Erreur lors de la récupération des séries");
|
throw error instanceof Error ? error : new Error("Erreur lors de la récupération des séries");
|
||||||
}
|
}
|
||||||
@@ -34,11 +32,7 @@ export default async function LibraryPage({ params, searchParams }: PageProps) {
|
|||||||
const unreadOnly = searchParams.unread === "true";
|
const unreadOnly = searchParams.unread === "true";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data: series, serverUrl } = await getLibrarySeries(
|
const { data: series } = await getLibrarySeries(params.libraryId, currentPage, unreadOnly);
|
||||||
params.libraryId,
|
|
||||||
currentPage,
|
|
||||||
unreadOnly
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container py-8 space-y-8">
|
<div className="container py-8 space-y-8">
|
||||||
@@ -52,7 +46,6 @@ export default async function LibraryPage({ params, searchParams }: PageProps) {
|
|||||||
</div>
|
</div>
|
||||||
<PaginatedSeriesGrid
|
<PaginatedSeriesGrid
|
||||||
series={series.content || []}
|
series={series.content || []}
|
||||||
serverUrl={serverUrl}
|
|
||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
totalPages={series.totalPages}
|
totalPages={series.totalPages}
|
||||||
totalElements={series.totalElements}
|
totalElements={series.totalElements}
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ import { redirect } from "next/navigation";
|
|||||||
|
|
||||||
export default async function HomePage() {
|
export default async function HomePage() {
|
||||||
try {
|
try {
|
||||||
const cookiesStore = cookies();
|
|
||||||
komgaConfigService.validateAndGetConfig(cookiesStore);
|
|
||||||
|
|
||||||
const data = await HomeService.getHomeData();
|
const data = await HomeService.getHomeData();
|
||||||
|
|
||||||
return <HomeContent data={data} />;
|
return <HomeContent data={data} />;
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ export default async function SeriesPage({ params, searchParams }: PageProps) {
|
|||||||
const unreadOnly = searchParams.unread === "true";
|
const unreadOnly = searchParams.unread === "true";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const cookiesStore = cookies();
|
|
||||||
const config = komgaConfigService.validateAndGetConfig(cookiesStore);
|
|
||||||
const pageIndex = currentPage - 1;
|
const pageIndex = currentPage - 1;
|
||||||
|
|
||||||
// Appels API parallèles pour les détails de la série et les tomes
|
// Appels API parallèles pour les détails de la série et les tomes
|
||||||
@@ -32,7 +30,6 @@ export default async function SeriesPage({ params, searchParams }: PageProps) {
|
|||||||
<SeriesHeader series={series} />
|
<SeriesHeader series={series} />
|
||||||
<PaginatedBookGrid
|
<PaginatedBookGrid
|
||||||
books={books.content || []}
|
books={books.content || []}
|
||||||
serverUrl={config.serverUrl}
|
|
||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
totalPages={books.totalPages}
|
totalPages={books.totalPages}
|
||||||
totalElements={books.totalElements}
|
totalElements={books.totalElements}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { cn } from "@/lib/utils";
|
|||||||
|
|
||||||
interface PaginatedSeriesGridProps {
|
interface PaginatedSeriesGridProps {
|
||||||
series: any[];
|
series: any[];
|
||||||
serverUrl: string;
|
|
||||||
currentPage: number;
|
currentPage: number;
|
||||||
totalPages: number;
|
totalPages: number;
|
||||||
totalElements: number;
|
totalElements: number;
|
||||||
@@ -18,7 +17,6 @@ interface PaginatedSeriesGridProps {
|
|||||||
|
|
||||||
export function PaginatedSeriesGrid({
|
export function PaginatedSeriesGrid({
|
||||||
series,
|
series,
|
||||||
serverUrl,
|
|
||||||
currentPage,
|
currentPage,
|
||||||
totalPages,
|
totalPages,
|
||||||
totalElements,
|
totalElements,
|
||||||
@@ -108,7 +106,7 @@ export function PaginatedSeriesGrid({
|
|||||||
isChangingPage ? "opacity-25" : "opacity-100"
|
isChangingPage ? "opacity-25" : "opacity-100"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<SeriesGrid series={series} serverUrl={serverUrl} />
|
<SeriesGrid series={series} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { useRouter } from "next/navigation";
|
|||||||
|
|
||||||
interface SeriesGridProps {
|
interface SeriesGridProps {
|
||||||
series: KomgaSeries[];
|
series: KomgaSeries[];
|
||||||
serverUrl: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fonction utilitaire pour obtenir les informations de lecture d'une série
|
// Fonction utilitaire pour obtenir les informations de lecture d'une série
|
||||||
@@ -36,7 +35,7 @@ const getReadingStatusInfo = (series: KomgaSeries) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function SeriesGrid({ series, serverUrl }: SeriesGridProps) {
|
export function SeriesGrid({ series }: SeriesGridProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
if (!series.length) {
|
if (!series.length) {
|
||||||
@@ -54,7 +53,6 @@ export function SeriesGrid({ series, serverUrl }: SeriesGridProps) {
|
|||||||
key={series.id}
|
key={series.id}
|
||||||
series={series}
|
series={series}
|
||||||
onClick={() => router.push(`/series/${series.id}`)}
|
onClick={() => router.push(`/series/${series.id}`)}
|
||||||
serverUrl={serverUrl}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -64,10 +62,9 @@ export function SeriesGrid({ series, serverUrl }: SeriesGridProps) {
|
|||||||
interface SeriesCardProps {
|
interface SeriesCardProps {
|
||||||
series: KomgaSeries;
|
series: KomgaSeries;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
serverUrl: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SeriesCard({ series, onClick, serverUrl }: SeriesCardProps) {
|
function SeriesCard({ series, onClick }: SeriesCardProps) {
|
||||||
const [imageError, setImageError] = useState(false);
|
const [imageError, setImageError] = useState(false);
|
||||||
const statusInfo = getReadingStatusInfo(series);
|
const statusInfo = getReadingStatusInfo(series);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { KomgaBook } from "@/types/komga";
|
|||||||
|
|
||||||
interface PaginatedBookGridProps {
|
interface PaginatedBookGridProps {
|
||||||
books: KomgaBook[];
|
books: KomgaBook[];
|
||||||
serverUrl: string;
|
|
||||||
currentPage: number;
|
currentPage: number;
|
||||||
totalPages: number;
|
totalPages: number;
|
||||||
totalElements: number;
|
totalElements: number;
|
||||||
@@ -19,7 +18,6 @@ interface PaginatedBookGridProps {
|
|||||||
|
|
||||||
export function PaginatedBookGrid({
|
export function PaginatedBookGrid({
|
||||||
books,
|
books,
|
||||||
serverUrl,
|
|
||||||
currentPage,
|
currentPage,
|
||||||
totalPages,
|
totalPages,
|
||||||
totalElements,
|
totalElements,
|
||||||
|
|||||||
Reference in New Issue
Block a user