fix(frontend): synchronize catalog navigation with URL
Build and Push Frontend / Construir y Subir Imagen (push) Failing after 29s
Build and Push Frontend / Construir y Subir Imagen (push) Failing after 29s
This commit is contained in:
@@ -2,7 +2,10 @@ import type { Metadata } from "next";
|
||||
import { CatalogClient } from "@/components/catalog/catalog-client";
|
||||
import { getProducts } from "@/lib/headless/client";
|
||||
|
||||
export const metadata: Metadata = { title: "Catálogo", description: "Explora todos los productos de Ari Shopping." };
|
||||
export const metadata: Metadata = {
|
||||
title: "Catálogo",
|
||||
description: "Explora todos los productos de Ari Shopping.",
|
||||
};
|
||||
|
||||
type CatalogPageProps = {
|
||||
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
||||
@@ -15,12 +18,19 @@ function single(value: string | string[] | undefined): string {
|
||||
export default async function CatalogPage({ searchParams }: CatalogPageProps) {
|
||||
const params = await searchParams;
|
||||
const products = await getProducts();
|
||||
|
||||
const category = single(params.category) || "Todos";
|
||||
const collection = single(params.collection);
|
||||
const query = single(params.q);
|
||||
const section = single(params.section);
|
||||
|
||||
return (
|
||||
<CatalogClient
|
||||
key={`${category}:${collection}:${query}:${section}`}
|
||||
products={products}
|
||||
initialCategory={single(params.category) || "Todos"}
|
||||
initialCollection={single(params.collection)}
|
||||
initialQuery={single(params.q)}
|
||||
initialCategory={category}
|
||||
initialCollection={collection}
|
||||
initialQuery={query}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user