From e4b39a4c385ff959b3b659868d981e6ff0fd2b22 Mon Sep 17 00:00:00 2001 From: DrMint Date: Mon, 17 Oct 2022 00:14:26 +0200 Subject: [PATCH] Fixed build --- src/pages/api/revalidate.ts | 6 +++--- src/pages/library/[slug]/reader.tsx | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/api/revalidate.ts b/src/pages/api/revalidate.ts index b55dd3b..ae162b5 100644 --- a/src/pages/api/revalidate.ts +++ b/src/pages/api/revalidate.ts @@ -144,7 +144,7 @@ const Revalidate = (req: NextApiRequest, res: NextApiResponse case "library-item": { paths.push(`/library`); paths.push(`/library/${body.entry.slug}`); - paths.push(`/library/${body.entry.slug}/scans`); + paths.push(`/library/${body.entry.slug}/reader`); body.entry.subitem_of.forEach((parentItem) => { paths.push(`/library/${parentItem.slug}`); }); @@ -165,7 +165,7 @@ const Revalidate = (req: NextApiRequest, res: NextApiResponse ranged_content.slug.length - body.entry.slug.length - 1 ); paths.push(`/library/${parentSlug}`); - paths.push(`/library/${parentSlug}/scans`); + paths.push(`/library/${parentSlug}/reader`); }); } break; @@ -180,7 +180,7 @@ const Revalidate = (req: NextApiRequest, res: NextApiResponse case "ranged-content": { if (body.entry.library_item) { paths.push(`/library/${body.entry.library_item.slug}`); - paths.push(`/library/${body.entry.library_item.slug}/scans`); + paths.push(`/library/${body.entry.library_item.slug}/reader`); } if (body.entry.content) { paths.push(`/contents/${body.entry.content.slug}`); diff --git a/src/pages/library/[slug]/reader.tsx b/src/pages/library/[slug]/reader.tsx index 0e14ca7..16b0d09 100644 --- a/src/pages/library/[slug]/reader.tsx +++ b/src/pages/library/[slug]/reader.tsx @@ -762,6 +762,8 @@ export const getStaticProps: GetStaticProps = async (context) => { const pageWidth = item.libraryItems.data[0].attributes.size?.width ?? 120; + if (pages.length === 0) return { notFound: true }; + const props: Props = { item: item.libraryItems.data[0].attributes, pages,