import { logout as apiLogout } from "../api.js"; export function renderHeader(pollingIntervalMs) { // Установка имени пользователя (заглушка) const userNameElement = document.getElementById("user-name"); if (userNameElement) { userNameElement.textContent = "User: admin"; // Заглушка, заменить на данные из /auth/me } // Отображение частоты опроса const pollingIntervalElement = document.getElementById("polling-interval"); if (pollingIntervalElement) { pollingIntervalElement.textContent = `Polling Interval: ${ pollingIntervalMs || 1000 } ms`; // Значение по умолчанию 1000 мс } // Отображение текущего времени const currentTimeElement = document.getElementById("current-time"); if (currentTimeElement) { function updateTime() { const now = new Date().toLocaleTimeString("ru-RU", { timeZone: "Europe/Moscow", hour12: false, }); currentTimeElement.textContent = `Current Time: ${now}`; } updateTime(); // Инициализация setInterval(updateTime, 1000); // Обновление каждую секунду } // Обработчик кнопки выхода const logoutBtn = document.getElementById("logout-btn"); if (logoutBtn) { logoutBtn.addEventListener("click", apiLogout); } }