17 lines
473 B
TypeScript
17 lines
473 B
TypeScript
import { redirect } from "next/navigation";
|
|
import { notFound } from "next/navigation";
|
|
import { getChapterVerseIndex } from "@/lib/api";
|
|
|
|
export default async function ChapterPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ chapter: string }>;
|
|
}) {
|
|
const { chapter } = await params;
|
|
const verseIndex = await getChapterVerseIndex("bg", null, parseInt(chapter));
|
|
if (verseIndex.length === 0) {
|
|
notFound();
|
|
}
|
|
redirect(`/books/bg/${chapter}/${verseIndex[0].verse}`);
|
|
}
|