diff --git a/.gitignore b/.gitignore index 67b161e..cf3ad75 100644 --- a/.gitignore +++ b/.gitignore @@ -41,5 +41,4 @@ next-env.d.ts env.local /lib/deprecated-backup public/git-info.json -public/git-info.json -public/git-info.json +*/git-info.json \ No newline at end of file diff --git a/lib/server-api.ts b/lib/server-api.ts index 6f78c2b..b9b8ed0 100644 --- a/lib/server-api.ts +++ b/lib/server-api.ts @@ -116,19 +116,24 @@ export const getCustomerDetailsServer = async (userId: string): Promise { - console.warn('Could not fetch real stats from API:', e); - return null; - }); + const url = getServerApiUrl('/stats/platform'); + + // Make direct request without auth + const res = await fetch(url, { + cache: 'no-store', // Always fetch fresh data + headers: { + 'Content-Type': 'application/json' + } + }); + + const data = await res.json(); // If we have real data, use it - if (serverData && Object.keys(serverData).length > 0) { - return serverData; + if (data && Object.keys(data).length > 0) { + return data; } - // If API call failed or returned empty data, use sample data + // If API returned empty data, use sample data console.info('Using sample stats data for demo'); return { orders: {