dasdsd
All checks were successful
Deploy / deploy-staging (push) Successful in 24s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-06-23 00:21:51 +02:00
parent a4378af9cf
commit b204da0319
2 changed files with 131 additions and 114 deletions

View File

@@ -119,7 +119,14 @@
credentials: 'same-origin',
headers: { Accept: 'application/json' }
});
const payload = await response.json();
const responseText = await response.text();
let payload = null;
try {
payload = JSON.parse(responseText);
} catch (_error) {
const preview = responseText.trim().slice(0, 160);
throw new Error(preview !== '' ? `Chart-API liefert kein JSON: ${preview}` : 'Chart-API liefert kein JSON.');
}
if (!payload.ok) {
throw new Error(payload.message || 'Chartdaten konnten nicht geladen werden.');
}