feat(core): update

This commit is contained in:
2026-06-21 20:20:20 +03:30
parent 4d995a61af
commit 58b027813d
15 changed files with 232 additions and 113 deletions

View File

@@ -1,20 +1,11 @@
import Image from 'next/image'
import productbg from '../public/productbg.webp'
import ProductCard from '@/components/ProductCard'
import { getPublicContent } from '@/lib/content'
import { productImages } from '@/lib/localImages'
async function getData(id) {
const res = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/public/content/index/${id}`)
if (!res.ok) {
throw new Error('Failed to fetch data')
}
return res.json()
}
export default async function Products({ lang }){
const data = await getData(lang === 'fa' ? 1 : 2);
const data = await getPublicContent(lang);
// Add safety checks for data structure
if (!data || typeof data !== 'object') {
@@ -33,7 +24,7 @@ export default async function Products({ lang }){
<div className="z-10 flex gap-4 overflow-x-auto px-6 py-16 sm:px-10 lg:flex-wrap lg:justify-center lg:gap-6 lg:px-28">
{
productImages.map((image, index) => (
<ProductCard key={image} image={image} desc={data.productDescs?.[index]?.body || ''} />
<ProductCard key={image.src} image={image} desc={data.productDescs?.[index]?.body || ''} />
))
}
</div>