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);