ElementById('allDevicesError').style.display = 'none';
    
    // Get current period from URL
    const urlParams = new URLSearchParams(window.location.search);
    const period = urlParams.get('period') || '1year';
    
    // Fetch all device revenues
    fetch(`/analytics/devices/all?period=${period}&sort=${currentSort.field}&order=${currentSort.order}`)
        .then(response => {
            if (!response.ok) {
                throw new Error(`HTTP ${response.status}: ${response.statusText}`);
       