fix: non-numeric page numbers now don't cause 500 Internal Server Error code
This commit is contained in:
parent
6f72cbba2a
commit
8e6ec9fbd5
1 changed files with 3 additions and 1 deletions
|
@ -40,6 +40,8 @@ export const metadata: Metadata = {
|
||||||
|
|
||||||
const BlogPage = async ({ params }: { params: { id: string } }) => {
|
const BlogPage = async ({ params }: { params: { id: string } }) => {
|
||||||
// Optionally, you can fetch some initial data here if needed.
|
// Optionally, you can fetch some initial data here if needed.
|
||||||
|
let id = parseInt(params.id);
|
||||||
|
if (isNaN(id)) id = 1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
|
@ -57,7 +59,7 @@ const BlogPage = async ({ params }: { params: { id: string } }) => {
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
<BlogCards page={parseInt(params.id)} />
|
<BlogCards page={id} />
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue