From 18683925a1a6e3f062522db1e7eafba73865b599 Mon Sep 17 00:00:00 2001 From: Piotr Oleszczyk Date: Sun, 1 Mar 2026 20:01:16 +0100 Subject: [PATCH] fix(frontend): use /api proxy for skin photo upload in browser context analyzeSkinPhotos was hardcoding PUBLIC_API_BASE, causing browser-side requests to hit localhost:8000 directly instead of going through nginx. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/lib/api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index cda76e5..454073c 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -268,7 +268,8 @@ export interface SkinPhotoAnalysisResponse { export async function analyzeSkinPhotos(files: File[]): Promise { const body = new FormData(); for (const file of files) body.append('photos', file); - const res = await fetch(`${PUBLIC_API_BASE}/skincare/analyze-photos`, { method: 'POST', body }); + const base = browser ? '/api' : PUBLIC_API_BASE; + const res = await fetch(`${base}/skincare/analyze-photos`, { method: 'POST', body }); if (!res.ok) { const detail = await res.json().catch(() => ({ detail: res.statusText })); throw new Error(detail?.detail ?? res.statusText);