fix
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -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
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user