fix: handle non-json api error responses

This commit is contained in:
a.tolmachev
2026-03-31 01:04:10 +03:00
parent fd30e8f626
commit a893ed01f5
+4 -4
View File
@@ -19,12 +19,12 @@
} }
var payload = null; var payload = null;
var text = ''; var text = await response.text();
if (text) {
try { try {
payload = await response.json(); payload = JSON.parse(text);
} catch (_error) { } catch (_error) {}
text = await response.text();
} }
if (!response.ok) { if (!response.ok) {