mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 00:43:54 +08:00
Revert e1315d2; always attempt to parse JSON
This way if there is a PHP error which outputs a 200 OK text/html response, Flarum will correctly show an error message.
This commit is contained in:
parent
7d4a04760c
commit
119d1721e0
|
@ -227,13 +227,11 @@ export default class App {
|
||||||
throw new RequestError(status, responseText, options, xhr);
|
throw new RequestError(status, responseText, options, xhr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xhr.getResponseHeader('content-type').indexOf('json') !== -1) {
|
|
||||||
try {
|
try {
|
||||||
return JSON.parse(responseText);
|
return JSON.parse(responseText);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new RequestError(500, responseText, options, xhr);
|
throw new RequestError(500, responseText, options, xhr);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.requestError) this.alerts.dismiss(this.requestError.alert);
|
if (this.requestError) this.alerts.dismiss(this.requestError.alert);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user