fix: Remove unused import in ProtectedRoute (Refs #2)

This commit is contained in:
2026-04-01 14:24:25 -03:00
parent 7b9a7192c1
commit 4b44a8da08
8 changed files with 37 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
import { LoginRequest, RegisterRequest, AuthResponse, RegisterResponse } from '../types/auth';
import { User } from '../types/user';
import type { LoginRequest, RegisterRequest, AuthResponse, RegisterResponse } from '../types/auth';
import type { User } from '../types/user';
const API_URL = import.meta.env.VITE_API_URL || '';
@@ -24,10 +24,12 @@ class ApiClient {
throw new Error('Unauthorized');
}
if (!response.ok) {
const errorData = await response.json().catch(() => ({}));
throw new Error(errorData.message || `Error ${response.status}`);
}
if (!response.ok) {
const errorData = await response.json().catch(() => ({}));
// Handle both { error: "message" } and { message: "..." } formats
const errorMessage = errorData.error || errorData.message || `Error ${response.status}`;
throw new Error(errorMessage);
}
return response.json();
}