refactor: centralize bundle filtering with filterOutBundles helper
Some checks failed
Build and Deploy / build (push) Has been cancelled
Some checks failed
Build and Deploy / build (push) Has been cancelled
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getProducts } from "@/lib/saleor";
|
||||
import { getProducts, filterOutBundles } from "@/lib/saleor";
|
||||
import { getTranslations, setRequestLocale } from "next-intl/server";
|
||||
import Header from "@/components/layout/Header";
|
||||
import Footer from "@/components/layout/Footer";
|
||||
@@ -40,10 +40,8 @@ export default async function Homepage({ params }: { params: Promise<{ locale: s
|
||||
console.log("Failed to fetch products during build");
|
||||
}
|
||||
|
||||
const filteredProducts = products?.filter(
|
||||
(p: any) => !p.name.includes("2x Set") && !p.name.includes("3x Set")
|
||||
);
|
||||
const featuredProducts = filteredProducts?.slice(0, 4) || [];
|
||||
const filteredProducts = filterOutBundles(products);
|
||||
const featuredProducts = filteredProducts.slice(0, 4);
|
||||
const hasProducts = featuredProducts.length > 0;
|
||||
|
||||
const basePath = `/${validLocale}`;
|
||||
|
||||
Reference in New Issue
Block a user