faculty page
This commit is contained in:
@ -12,13 +12,14 @@ export const dynamic = "force-dynamic";
|
|||||||
export const dynamicParams = true;
|
export const dynamicParams = true;
|
||||||
|
|
||||||
type PageProps = {
|
type PageProps = {
|
||||||
params: {
|
params: Promise<{ // ← Now a Promise in Next.js 15
|
||||||
id: string;
|
id: string;
|
||||||
};
|
}>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default async function FacultyPage({ params }: PageProps) {
|
export default async function FacultyPage({ params }: PageProps) {
|
||||||
const memberId = Number(params.id);
|
const { id } = await params; // ← Must await before accessing
|
||||||
|
const memberId = Number(id);
|
||||||
|
|
||||||
// Guard against invalid IDs
|
// Guard against invalid IDs
|
||||||
if (!Number.isInteger(memberId)) {
|
if (!Number.isInteger(memberId)) {
|
||||||
@ -56,7 +57,8 @@ export default async function FacultyPage({ params }: PageProps) {
|
|||||||
export async function generateMetadata(
|
export async function generateMetadata(
|
||||||
{ params }: PageProps
|
{ params }: PageProps
|
||||||
): Promise<Metadata> {
|
): Promise<Metadata> {
|
||||||
const memberId = Number(params.id);
|
const { id } = await params; // ← Must await here too
|
||||||
|
const memberId = Number(id);
|
||||||
|
|
||||||
if (!Number.isInteger(memberId)) {
|
if (!Number.isInteger(memberId)) {
|
||||||
return {
|
return {
|
||||||
@ -92,4 +94,4 @@ export async function generateMetadata(
|
|||||||
title: "Faculty Member - CMC Vellore",
|
title: "Faculty Member - CMC Vellore",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user