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