1
0
mirror of https://github.com/flarum/core.git synced 2025-10-12 15:34:26 +02:00

feat: re-add debug button/modal

Fixes #1687
This commit is contained in:
Moritz Stueckler
2019-10-08 20:20:19 +02:00
committed by David Sevilla Martín
parent 9c0d921f49
commit c87ebaef08
3 changed files with 49 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
import Modal from './Modal';
export default class RequestErrorModal extends Modal {
className() {
return 'RequestErrorModal Modal--large';
}
title() {
return this.props.error.xhr
? this.props.error.xhr.status+' '+this.props.error.xhr.statusText
: '';
}
content() {
let responseText;
try {
responseText = JSON.stringify(JSON.parse(this.props.error.responseText), null, 2);
} catch (e) {
responseText = this.props.error.responseText;
}
return <div className="Modal-body">
<pre>
{this.props.error.options.method} {this.props.error.options.url}<br/><br/>
{responseText}
</pre>
</div>;
}
}