dasdsd
This commit is contained in:
@@ -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.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user