fix(web): adiciona prefixo /api/v1 no apiFetch — proxy Vite não roteava

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-28 00:55:42 +00:00
parent a9c15ac4ec
commit acab5b8a55

View File

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