🎉 Improved API Response Validation & Documentation 🖥️📚
This commit is contained in:
@@ -189,11 +189,7 @@ function getDefaultChartOptions() {
|
||||
async function createJobStatusChart() {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/api/stats/charts/job-status`);
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Fehler beim Laden der Job-Status-Daten');
|
||||
}
|
||||
const data = await validateApiResponse(response, 'Job-Status-Chart-Daten');
|
||||
|
||||
const ctx = document.getElementById('job-status-chart');
|
||||
if (!ctx) return;
|
||||
@@ -254,11 +250,7 @@ async function createJobStatusChart() {
|
||||
async function createPrinterUsageChart() {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/api/stats/charts/printer-usage`);
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Fehler beim Laden der Drucker-Nutzung-Daten');
|
||||
}
|
||||
const data = await validateApiResponse(response, 'Drucker-Nutzung-Chart-Daten');
|
||||
|
||||
const ctx = document.getElementById('printer-usage-chart');
|
||||
if (!ctx) return;
|
||||
@@ -294,11 +286,7 @@ async function createPrinterUsageChart() {
|
||||
async function createJobsTimelineChart() {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/api/stats/charts/jobs-timeline`);
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Fehler beim Laden der Jobs-Timeline-Daten');
|
||||
}
|
||||
const data = await validateApiResponse(response, 'Jobs-Timeline-Chart-Daten');
|
||||
|
||||
const ctx = document.getElementById('jobs-timeline-chart');
|
||||
if (!ctx) return;
|
||||
@@ -342,11 +330,7 @@ async function createJobsTimelineChart() {
|
||||
async function createUserActivityChart() {
|
||||
try {
|
||||
const response = await fetch('/api/stats/charts/user-activity');
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Fehler beim Laden der Benutzer-Aktivität-Daten');
|
||||
}
|
||||
const data = await validateApiResponse(response, 'Benutzer-Aktivität-Chart-Daten');
|
||||
|
||||
const ctx = document.getElementById('user-activity-chart');
|
||||
if (!ctx) return;
|
||||
|
Reference in New Issue
Block a user