fp/packages/next/app/vt/[slug]/vods/page.tsx

26 lines
956 B
TypeScript
Raw Normal View History

2024-01-20 16:16:14 +00:00
2024-07-10 22:11:18 +00:00
import VodsList, { VodsListHeading } from '@/app/components/vods-list'
import { getVtuberBySlug, getUrl } from '@/app/lib/vtubers'
import { IVodsResponse, getVodsForVtuber, getPaginatedUrl } from '@/app/lib/vods'
import Pager from '@/app/components/pager'
2024-01-20 16:16:14 +00:00
import { notFound } from 'next/navigation'
interface IPageParams {
params: {
slug: string;
}
}
export default async function Page({ params }: IPageParams) {
const vtuber = await getVtuberBySlug(params.slug)
if (!vtuber) notFound();
const vods = await getVodsForVtuber(vtuber.id, 1, 24)
if (!vods) notFound();
return (
<>
<VodsListHeading slug={vtuber.attributes.slug} displayName={vtuber.attributes.displayName}></VodsListHeading>
<VodsList vtuber={vtuber} vods={vods.data} page={1} pageSize={24} />
<Pager baseUrl={`/vt/${params.slug}/vods`} page={1} pageCount={vods.meta.pagination.pageCount} />
</>
)
}