@@ -11,19 +11,18 @@ import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { getActivePortfolioCategories, getPublishedPortfolioProjects } from "@/lib/portfolio";
|
||||
|
||||
type PortfolioPageProps = {
|
||||
params: {
|
||||
params: Promise<{
|
||||
locale: string;
|
||||
};
|
||||
searchParams?: {
|
||||
}>;
|
||||
searchParams?: Promise<{
|
||||
category?: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function generateMetadata({
|
||||
params: { locale },
|
||||
}: PortfolioPageProps): Promise<Metadata> {
|
||||
export async function generateMetadata({ params }: PortfolioPageProps): Promise<Metadata> {
|
||||
const { locale } = await params;
|
||||
const localeKey = resolveLocale(locale);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "portfolioPage" });
|
||||
|
||||
@@ -36,12 +35,16 @@ export async function generateMetadata({
|
||||
}
|
||||
|
||||
export default async function PortfolioPage({
|
||||
params: { locale },
|
||||
params,
|
||||
searchParams,
|
||||
}: PortfolioPageProps) {
|
||||
const [{ locale }, resolvedSearchParams] = await Promise.all([
|
||||
params,
|
||||
searchParams,
|
||||
]);
|
||||
const localeKey = resolveLocale(locale);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "portfolioPage" });
|
||||
const selectedCategory = searchParams?.category ?? "";
|
||||
const selectedCategory = resolvedSearchParams?.category ?? "";
|
||||
|
||||
if (selectedCategory) {
|
||||
redirect(getLocalizedPath(localeKey, `/portfolio/category/${selectedCategory}`));
|
||||
|
||||
Reference in New Issue
Block a user