diff --git a/src/app/chapter/[chapterNumber]/(chapter)/[[...locale]]/page.tsx b/src/app/chapter/[chapterNumber]/(chapter)/[[...locale]]/page.tsx index 096964d..e7f8e9d 100644 --- a/src/app/chapter/[chapterNumber]/(chapter)/[[...locale]]/page.tsx +++ b/src/app/chapter/[chapterNumber]/(chapter)/[[...locale]]/page.tsx @@ -20,7 +20,7 @@ export async function generateMetadata({ params }: Props): Promise { const { chapterNumber } = params; const chapterData = await getChapterData( paramsToLocale(params), - parseInt(chapterNumber), + Number(chapterNumber) || 1, ); if (!chapterData) { return {}; @@ -85,7 +85,7 @@ export default async function Chapter({ params }: Props) { const chapterData = await getChapterData( locale, - parseInt(chapterNumber), + Number(chapterNumber) || 1, languageSettings.translationAuthor.id, ); diff --git a/src/app/chapter/[chapterNumber]/verse/[verseNumber]/[[...locale]]/page.tsx b/src/app/chapter/[chapterNumber]/verse/[verseNumber]/[[...locale]]/page.tsx index 5d3d35a..44f1b43 100644 --- a/src/app/chapter/[chapterNumber]/verse/[verseNumber]/[[...locale]]/page.tsx +++ b/src/app/chapter/[chapterNumber]/verse/[verseNumber]/[[...locale]]/page.tsx @@ -74,8 +74,8 @@ const Verse = async ({ params }: Props) => { }); const verseData = await getVerseData( - Number(chapterNumber), - Number(verseNumber), + Number(chapterNumber) || 1, + Number(verseNumber) || 1, languageSettings.commentaryAuthor.id, languageSettings.translationAuthor.id, ); diff --git a/src/gqty-client/index.ts b/src/gqty-client/index.ts index c27b077..5ac2ddd 100644 --- a/src/gqty-client/index.ts +++ b/src/gqty-client/index.ts @@ -17,7 +17,10 @@ const queryFetcher: QueryFetcher = async function ( variables, fetchOptions, ) { - const response = await fetch(process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT!, { + if (!process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT) { + throw new Error("NEXT_PUBLIC_GRAPHQL_ENDPOINT should be present"); + } + const response = await fetch(process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT, { method: "POST", headers: { "Content-Type": "application/json",