diff --git a/backend/static/js/admin-unified.js b/backend/static/js/admin-unified.js index 3227159da..e7f08010f 100644 --- a/backend/static/js/admin-unified.js +++ b/backend/static/js/admin-unified.js @@ -332,8 +332,12 @@ class AdminDashboard { try { const url = `${this.apiBaseUrl}/api/stats`; const response = await fetch(url); - const data = await this.validateApiResponse(response, 'Live-Statistiken'); + if (!response.ok) { + throw new Error(`HTTP ${response.status}: ${response.statusText}`); + } + + const data = await response.json(); this.updateStatsDisplay(data); this.retryCount = 0; @@ -343,8 +347,6 @@ class AdminDashboard { if (this.retryCount <= this.maxRetries) { setTimeout(() => this.loadLiveStats(), 5000); - } else { - this.showNotification('Live-Statistiken konnten nicht geladen werden', 'error'); } } } @@ -622,7 +624,12 @@ class AdminDashboard { async loadUserData(userId) { try { const response = await fetch(`${this.apiBaseUrl}/api/admin/users/${userId}`); - const data = await this.validateApiResponse(response, 'Benutzerdaten laden'); + + if (!response.ok) { + throw new Error(`HTTP ${response.status}: ${response.statusText}`); + } + + const data = await response.json(); if (data.success) { const user = data.user; @@ -642,7 +649,7 @@ class AdminDashboard { } } catch (error) { console.error('Fehler beim Laden der Benutzerdaten:', error); - this.showNotification(`❌ Fehler beim Laden der Benutzerdaten: ${error.message}`, 'error'); + this.showNotification('❌ Fehler beim Laden der Benutzerdaten', 'error'); } } @@ -673,7 +680,7 @@ class AdminDashboard { body: JSON.stringify(userData) }); - const data = await this.validateApiResponse(response, 'Benutzer erstellen'); + const data = await response.json(); if (data.success) { this.showNotification('✅ Benutzer erfolgreich erstellt!', 'success'); @@ -888,101 +895,20 @@ class AdminDashboard { } // Error-Management - /** - * Zentrale API-Response-Validierung mit umfassendem Error-Handling - * @param {Response} response - Fetch Response-Objekt - * @param {string} context - Kontext der API-Anfrage für bessere Fehlermeldungen - * @returns {Promise - + + - + + + +
{% endblock %} {% block content %} - +- Verwaltung des 3D-Drucker-Systems für die Technische Berufsausbildung Werk Marienfelde + Verwaltung des Steckdosen-Steuerungssystems für die Technische Berufsausbildung Werk Marienfelde
- +Benutzer | +Rolle | +Status | +Letzte Aktivität | +Aktionen | +|
---|---|---|---|---|---|
+
+
+
+
+
+ {{ user.username[0].upper() }}
+
+
+
+ {{ user.username }}
+ {{ user.first_name }} {{ user.last_name }}
+ |
+ {{ user.email }} | ++ + {{ 'Administrator' if user.is_admin else 'Benutzer' }} + + | ++ + + {{ 'Aktiv' if user.is_active else 'Inaktiv' }} + + | ++ {{ user.last_login | format_datetime if user.last_login else 'Nie' }} + | +
+
+
+
+
+ |
+
Wählen Sie einen Bereich aus, um zu beginnen.
- - - +Wählen Sie einen Tab aus, um zu beginnen.