(endpoint);
return data;
} catch (error) {
console.error('[Products] Detail error:', error);
diff --git a/apps/frontend/src/views/ProductView.jsx b/apps/frontend/src/views/ProductView.jsx
index 7f31f36..64554ea 100644
--- a/apps/frontend/src/views/ProductView.jsx
+++ b/apps/frontend/src/views/ProductView.jsx
@@ -17,13 +17,18 @@ export default function ProductView({ source, id, onBack }) {
setError(null);
setPharmacies([]);
try {
- const response = await fetch(`/api/products/${source}/${id}`);
+ // Use different endpoint for parapharmacy products
+ const apiUrl = source === 'parapharmacy'
+ ? `/api/products/parapharmacy/${id}`
+ : `/api/products/${source}/${id}`;
+
+ const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error('Producto no encontrado');
}
const data = await response.json();
setProduct(data);
- loadPharmacies(source, data.id);
+ loadPharmacies(source, data.id || data._id);
} catch (err) {
setError(err.message);
} finally {
@@ -71,8 +76,9 @@ export default function ProductView({ source, id, onBack }) {
if (!product) return null;
const isCima = product.source === 'cima';
+ const isParapharmacy = product.source !== 'cima';
const sourceColor = isCima ? '#2563eb' : '#16a34a';
- const sourceLabel = isCima ? 'CIMA' : 'Open Food Facts';
+ const sourceLabel = isCima ? 'CIMA' : 'Parafarmacia';
return (
@@ -116,17 +122,20 @@ export default function ProductView({ source, id, onBack }) {
>
) : (
<>
- {product.nutriscore && product.nutriscore !== 'not-applicable' && product.nutriscore !== 'unknown' && (
-
+ {product.price && (
+
)}
- {product.nova_group && (
-
+ {product.original_price && product.original_price > product.price && (
+
)}
- {product.eco_score && product.eco_score !== 'unknown' && (
-
+ {product.category && (
+
)}
- {product.ingredients && (
-
+ {product.brand && (
+
+ )}
+ {product.source_url && (
+
)}
>
)}