This commit is contained in:
NotII
2025-03-28 22:56:57 +00:00
parent 546e7bd245
commit 1bec653206
5 changed files with 274 additions and 24 deletions

View File

@@ -14,6 +14,8 @@ export interface PlatformStats {
export async function fetchPlatformStats(): Promise<PlatformStats> {
const BASE_API_URL = process.env.SERVER_API_URL || 'http://localhost:3001/api';
console.log('Fetching platform stats from:', BASE_API_URL);
try {
const response = await fetch(`${BASE_API_URL}/stats/platform`, {
method: 'GET',
@@ -27,7 +29,9 @@ export async function fetchPlatformStats(): Promise<PlatformStats> {
throw new Error(`API error: ${response.status}`);
}
return await response.json();
const data = await response.json();
console.log('Fetched stats:', data);
return data;
} catch (error) {
console.error('Error fetching platform stats:', error);
// Return fallback data if API fails