fix: non-numeric page numbers now don't cause 500 Internal Server Error code

This commit is contained in:
Dorian Niemiec 2024-09-07 17:57:29 +02:00
parent 6f72cbba2a
commit 8e6ec9fbd5

View file

@ -40,6 +40,8 @@ export const metadata: Metadata = {
const BlogPage = async ({ params }: { params: { id: string } }) => {
// Optionally, you can fetch some initial data here if needed.
let id = parseInt(params.id);
if (isNaN(id)) id = 1;
return (
<section
@ -57,7 +59,7 @@ const BlogPage = async ({ params }: { params: { id: string } }) => {
</Button>
</Link>
</p>
<BlogCards page={parseInt(params.id)} />
<BlogCards page={id} />
</section>
);
};