From dca7e373cd4b9e21ceab10db8188ea0285d36ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoni=20Nu=C3=B1ez=20Romeu?= Date: Thu, 16 Jul 2026 16:23:57 +0200 Subject: [PATCH] fix: use parapharmacy endpoint for all non-CIMA sources - ProductView now checks if source is 'cima' to decide endpoint - All other sources (seed, promofarma, docmorris, primor) use parapharmacy endpoint - Same fix applied to mobile getProduct function Before: only 'parapharmacy' source used parapharmacy endpoint After: all non-CIMA sources use parapharmacy endpoint --- apps/frontend-mobile/services/products.ts | 9 +++++---- apps/frontend/src/views/ProductView.jsx | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/frontend-mobile/services/products.ts b/apps/frontend-mobile/services/products.ts index 9da3168..f30d2d3 100644 --- a/apps/frontend-mobile/services/products.ts +++ b/apps/frontend-mobile/services/products.ts @@ -105,10 +105,11 @@ export async function getParapharmacyBrands(): Promise { export async function getProduct(source: string, id: string): Promise { try { - // Use different endpoint for parapharmacy products - const endpoint = source === 'parapharmacy' - ? `/products/parapharmacy/${id}` - : `/products/${source}/${id}`; + // Use parapharmacy endpoint for all non-CIMA sources + const isCima = source === 'cima'; + const endpoint = isCima + ? `/products/${source}/${id}` + : `/products/parapharmacy/${id}`; const { data } = await api.get(endpoint); return data; diff --git a/apps/frontend/src/views/ProductView.jsx b/apps/frontend/src/views/ProductView.jsx index 64554ea..378dfdc 100644 --- a/apps/frontend/src/views/ProductView.jsx +++ b/apps/frontend/src/views/ProductView.jsx @@ -17,10 +17,11 @@ export default function ProductView({ source, id, onBack }) { setError(null); setPharmacies([]); try { - // Use different endpoint for parapharmacy products - const apiUrl = source === 'parapharmacy' - ? `/api/products/parapharmacy/${id}` - : `/api/products/${source}/${id}`; + // Use parapharmacy endpoint for all non-CIMA sources + const isCima = source === 'cima'; + const apiUrl = isCima + ? `/api/products/${source}/${id}` + : `/api/products/parapharmacy/${id}`; const response = await fetch(apiUrl); if (!response.ok) {