Files
spsays-training/app/books/cc/[lila]/[chapter]/page.tsx
T

17 lines
503 B
TypeScript

import { redirect } from "next/navigation";
import { notFound } from "next/navigation";
import { getChapterVerseIndex } from "@/lib/api";
export default async function CcChapterPage({
params,
}: {
params: Promise<{ lila: string; chapter: string }>;
}) {
const { lila, chapter } = await params;
const verseIndex = await getChapterVerseIndex("cc", lila, parseInt(chapter));
if (verseIndex.length === 0) {
notFound();
}
redirect(`/books/cc/${lila}/${chapter}/${verseIndex[0].verse}`);
}