This commit is contained in:
NotII
2025-04-08 23:47:09 +01:00
parent bbdd327de5
commit db26544926
2 changed files with 15 additions and 11 deletions

3
.gitignore vendored
View File

@@ -41,5 +41,4 @@ next-env.d.ts
env.local env.local
/lib/deprecated-backup /lib/deprecated-backup
public/git-info.json public/git-info.json
public/git-info.json */git-info.json
public/git-info.json

View File

@@ -116,19 +116,24 @@ export const getCustomerDetailsServer = async (userId: string): Promise<Customer
// Server-side platform stats function // Server-side platform stats function
export async function getPlatformStatsServer() { export async function getPlatformStatsServer() {
try { try {
// Try to fetch from server first const url = getServerApiUrl('/stats/platform');
const serverData = await fetchServer('/stats/platform')
.catch(e => { // Make direct request without auth
console.warn('Could not fetch real stats from API:', e); const res = await fetch(url, {
return null; 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 we have real data, use it
if (serverData && Object.keys(serverData).length > 0) { if (data && Object.keys(data).length > 0) {
return serverData; 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'); console.info('Using sample stats data for demo');
return { return {
orders: { orders: {