From 2103b105ac9ba5e21ce5c23dd08b5512df46326c Mon Sep 17 00:00:00 2001
From: parsa aghaei
Date: Sat, 11 Jul 2026 14:02:04 +0330
Subject: [PATCH] fix: map imageUrl from backend to frontend image field
---
frontend/application/lib/services/productService.ts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/frontend/application/lib/services/productService.ts b/frontend/application/lib/services/productService.ts
index 14fb761a..5311b20c 100644
--- a/frontend/application/lib/services/productService.ts
+++ b/frontend/application/lib/services/productService.ts
@@ -46,10 +46,10 @@ export class ProductService {
onSetOfAction: data.onSetOfAction,
optimisticTemplate: data.optimisticTemplate,
feedingAdvice: data.feedingAdvice,
- image: data.image,
+ image: data.imageUrl?.startsWith('http') ? data.imageUrl : data.imageUrl ? `http://localhost:4001${data.imageUrl}` : data.image,
- main_ingredients: data.ingredients?.map((i: any) => i.ingredient) || [],
- symptoms: data.symptoms?.map((s: any) => s.symptom) || [],
+ main_ingredients: data.ingredientList?.map((i: any) => i.ingredient) || data.ingredients?.split(/[،,-]/).map((s: string) => s.trim()).filter(Boolean) || [],
+ symptoms: data.symptoms?.map((s: any) => s.symptom || s) || [],
keyBenefits: safeParse(data.keyBenefits, []),
expectedResults: safeParse(data.expectedResults, []),
benefitsList: safeParse(data.benefitsList, []),