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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user