Files
spsays-training/app/books/sb/[canto]/[chapter]/page.tsx
T

17 lines
507 B
TypeScript

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