Feat/parapharmacy api #38

Merged
Ichitux merged 25 commits from feat/parapharmacy-api into main 2026-07-16 15:38:59 +00:00
2 changed files with 10 additions and 8 deletions
Showing only changes of commit dca7e373cd - Show all commits
+5 -4
View File
@@ -105,10 +105,11 @@ export async function getParapharmacyBrands(): Promise<string[]> {
export async function getProduct(source: string, id: string): Promise<Product | null> { export async function getProduct(source: string, id: string): Promise<Product | null> {
try { try {
// Use different endpoint for parapharmacy products // Use parapharmacy endpoint for all non-CIMA sources
const endpoint = source === 'parapharmacy' const isCima = source === 'cima';
? `/products/parapharmacy/${id}` const endpoint = isCima
: `/products/${source}/${id}`; ? `/products/${source}/${id}`
: `/products/parapharmacy/${id}`;
const { data } = await api.get<Product>(endpoint); const { data } = await api.get<Product>(endpoint);
return data; return data;
+5 -4
View File
@@ -17,10 +17,11 @@ export default function ProductView({ source, id, onBack }) {
setError(null); setError(null);
setPharmacies([]); setPharmacies([]);
try { try {
// Use different endpoint for parapharmacy products // Use parapharmacy endpoint for all non-CIMA sources
const apiUrl = source === 'parapharmacy' const isCima = source === 'cima';
? `/api/products/parapharmacy/${id}` const apiUrl = isCima
: `/api/products/${source}/${id}`; ? `/api/products/${source}/${id}`
: `/api/products/parapharmacy/${id}`;
const response = await fetch(apiUrl); const response = await fetch(apiUrl);
if (!response.ok) { if (!response.ok) {