diff --git a/src/app/page.tsx b/src/app/page.tsx index f5ebe28..4d3d01f 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -15,7 +15,13 @@ export const metadata = { }; export default async function Homepage() { - const products = await getProducts(); + let products: any[] = []; + try { + products = await getProducts(); + } catch (e) { + // Fallback for build time when API is unavailable + console.log('Failed to fetch products during build'); + } const featuredProduct = products.find((p) => p.status === "publish"); const publishedProducts = products .filter((p) => p.status === "publish") diff --git a/src/app/products/page.tsx b/src/app/products/page.tsx index b278811..ebbd4d6 100644 --- a/src/app/products/page.tsx +++ b/src/app/products/page.tsx @@ -9,7 +9,12 @@ export const metadata = { }; export default async function ProductsPage() { - const products = await getProducts(); + let products: any[] = []; + try { + products = await getProducts(); + } catch (e) { + console.log('Failed to fetch products during build'); + } const publishedProducts = products.filter((p) => p.status === "publish");