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
/lib/deprecated-backup
public/git-info.json
public/git-info.json
public/git-info.json
*/git-info.json

View File

@@ -116,19 +116,24 @@ export const getCustomerDetailsServer = async (userId: string): Promise<Customer
// Server-side platform stats function
export async function getPlatformStatsServer() {
try {
// Try to fetch from server first
const serverData = await fetchServer('/stats/platform')
.catch(e => {
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: {