fix(admin): safely resolve category name for Category | string union type on product list row

This commit is contained in:
parsa aghaei 2026-08-03 12:00:27 +03:30
parent bf213bb05d
commit 68c7656964

View File

@ -347,7 +347,11 @@ export default function Products() {
{product.nameEn && <span className="text-xs text-gray-400 font-mono" dir="ltr">{product.nameEn}</span>}
</div>
</td>
<td className="py-4 px-6 text-gray-600 text-sm">{product.category?.name || 'بدون دسته'}</td>
<td className="py-4 px-6 text-gray-600 text-sm">
{typeof product.category === 'object' && product.category !== null
? (product.category.nameFa || product.category.name || 'بدون دسته')
: (product.category || 'بدون دسته')}
</td>
<td className="py-4 px-6">
<div className="flex flex-col">
<span className="font-bold text-gray-900">{Number(product.priceValue).toLocaleString()} تومان</span>