mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Fix "Unexpected end of input" JSON parse exceptions
This commit is contained in:
parent
5e6b483149
commit
30ba85d937
@ -39,8 +39,8 @@ class Requests {
|
||||
// If the responses' body does not contain any data,
|
||||
// fetch will resolve responseText to the string 'None'.
|
||||
// If this is the case, we can not try to parse it as JSON.
|
||||
if(responseText !== 'None') {
|
||||
let body = JSON.parse(responseText);
|
||||
if (responseText && responseText !== 'None') {
|
||||
const body = JSON.parse(responseText);
|
||||
|
||||
if(body && body.errors) {
|
||||
let error = new Error('Form Error');
|
||||
|
Loading…
Reference in New Issue
Block a user