From acab5b8a55fff9f7811c7905b03ea4d1e1146f0f Mon Sep 17 00:00:00 2001 From: julian Date: Thu, 28 May 2026 00:55:42 +0000 Subject: [PATCH] =?UTF-8?q?fix(web):=20adiciona=20prefixo=20/api/v1=20no?= =?UTF-8?q?=20apiFetch=20=E2=80=94=20proxy=20Vite=20n=C3=A3o=20roteava?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- apps/web/src/lib/api-client.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/web/src/lib/api-client.ts b/apps/web/src/lib/api-client.ts index 445700b..4814c46 100644 --- a/apps/web/src/lib/api-client.ts +++ b/apps/web/src/lib/api-client.ts @@ -12,6 +12,10 @@ import { authStore } from './auth-store'; const PROBLEM_CONTENT_TYPE = 'application/problem+json'; +// Prefixo canônico: proxy Vite (/api → :3000) + versão da API. +// Em produção o Nginx faz o mesmo roteamento pelo mesmo prefixo. +const API_BASE = '/api/v1'; + export interface ProblemDetails { type: string; title: string; @@ -54,7 +58,7 @@ export async function apiFetch(path: string, options: RequestOptions = {}): Prom ...(body !== undefined ? { body: JSON.stringify(body) } : {}), }; - const response = await fetch(path, init); + const response = await fetch(`${API_BASE}${path}`, init); if (!response.ok) { throw await toApiError(response);