From b260d5f6d3c187020e9d315bdee651042b3c013b Mon Sep 17 00:00:00 2001 From: devops Date: Tue, 14 Jul 2026 12:33:14 +0000 Subject: [PATCH] fix: productService image URL and api.ts fallback --- frontend/application/lib/services/api.ts | 2 +- frontend/application/lib/services/productService.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/application/lib/services/api.ts b/frontend/application/lib/services/api.ts index 4750f0c5..02e894c7 100644 --- a/frontend/application/lib/services/api.ts +++ b/frontend/application/lib/services/api.ts @@ -1,6 +1,6 @@ import axios from 'axios'; -const baseURL = typeof window !== 'undefined' ? '/api' : (process.env.NEXT_PUBLIC_API_URL || 'http://localhost:4001/api'); +const baseURL = typeof window !== 'undefined' ? '/api' : (process.env.NEXT_PUBLIC_API_URL || '/api'); const api = axios.create({ baseURL, diff --git a/frontend/application/lib/services/productService.ts b/frontend/application/lib/services/productService.ts index 7d960cbe..7c8c6d0f 100644 --- a/frontend/application/lib/services/productService.ts +++ b/frontend/application/lib/services/productService.ts @@ -56,7 +56,7 @@ export class ProductService { onSetOfAction: data.onSetOfAction, optimisticTemplate: data.optimisticTemplate, feedingAdvice: data.feedingAdvice, - image: data.imageUrl?.startsWith('http') ? data.imageUrl : data.imageUrl ? `http://localhost:4001${data.imageUrl}` : data.image, + image: data.imageUrl?.startsWith('http') ? data.imageUrl : data.imageUrl ? `/api${data.imageUrl}` : data.image, 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) || [],