// widgets/dashboard/script.js

async function refreshDashboard() {
	try {
		const response = await fetch('/api/status');
		const data = await response.json();
		
		document.getElementById('dash-mode').textContent = data.mode;
		document.getElementById('dash-ip').textContent = data.ip;
		document.getElementById('dash-uptime').textContent = data.uptime;
		
		if (window.AquaScape && typeof window.AquaScape.updateStatus === 'function') {
			window.AquaScape.updateStatus(data.mode, data.ip);
		}
	} catch (error) {
		console.error('Failed to fetch status:', error);
	}
}

// Автозагрузка при открытии страницы виджета
refreshDashboard();