perf: promise all on ssr pages
This commit is contained in:
@@ -42,14 +42,10 @@ async function getLibrarySeries(
|
|||||||
try {
|
try {
|
||||||
const pageIndex = page - 1;
|
const pageIndex = page - 1;
|
||||||
|
|
||||||
const series: LibraryResponse<KomgaSeries> = await LibraryService.getLibrarySeries(
|
const [series, library] = await Promise.all([
|
||||||
libraryId,
|
LibraryService.getLibrarySeries(libraryId, pageIndex, size, unreadOnly, search),
|
||||||
pageIndex,
|
LibraryService.getLibrary(libraryId)
|
||||||
size,
|
]);
|
||||||
unreadOnly,
|
|
||||||
search
|
|
||||||
);
|
|
||||||
const library: KomgaLibrary = await LibraryService.getLibrary(libraryId);
|
|
||||||
|
|
||||||
return { data: series, library };
|
return { data: series, library };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -27,13 +27,10 @@ async function getSeriesBooks(
|
|||||||
try {
|
try {
|
||||||
const pageIndex = page - 1;
|
const pageIndex = page - 1;
|
||||||
|
|
||||||
const books: LibraryResponse<KomgaBook> = await SeriesService.getSeriesBooks(
|
const [books, series] = await Promise.all([
|
||||||
seriesId,
|
SeriesService.getSeriesBooks(seriesId, pageIndex, size, unreadOnly),
|
||||||
pageIndex,
|
SeriesService.getSeries(seriesId)
|
||||||
size,
|
]);
|
||||||
unreadOnly
|
|
||||||
);
|
|
||||||
const series: KomgaSeries = await SeriesService.getSeries(seriesId);
|
|
||||||
|
|
||||||
return { data: books, series };
|
return { data: books, series };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user