fix: Remove unused import in ProtectedRoute (Refs #2)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user