fp/services/next/app/latest-vods/[page]/page.tsx

33 lines
777 B
TypeScript
Raw Normal View History

2024-07-10 22:11:18 +00:00
import VodsList from '@/app/components/vods-list';
import { getVods } from '@/app/lib/vods';
import Pager from '@/app/components/pager';
2024-01-20 16:16:14 +00:00
interface IPageParams {
params: {
page: number;
};
}
export default async function Page({ params: { page } }: IPageParams) {
let vods;
try {
vods = await getVods(page, 24, true);
} catch (error) {
console.error("An error occurred:", error);
return <div>Error: {JSON.stringify(error)}</div>;
}
return (
<>
<h2 className='title is-2'>Latest VODs</h2>
<p className='subtitle'>page {page}</p>
<VodsList vods={vods.data} page={page} pageSize={24} />
<Pager
baseUrl='/latest-vods'
page={page}
pageCount={vods.meta.pagination.pageCount}
/>
</>
);
}