2015-09-18 15:16:46 +08:00
|
|
|
import Modal from 'flarum/components/Modal';
|
|
|
|
|
|
|
|
export default class RequestErrorModal extends Modal {
|
|
|
|
className() {
|
|
|
|
return 'RequestErrorModal Modal--large';
|
|
|
|
}
|
|
|
|
|
2015-10-21 08:17:07 +08:00
|
|
|
title() {
|
|
|
|
return this.props.error.xhr
|
|
|
|
? this.props.error.xhr.status+' '+this.props.error.xhr.statusText
|
|
|
|
: '';
|
|
|
|
}
|
|
|
|
|
2015-09-18 15:16:46 +08:00
|
|
|
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">
|
2015-10-21 08:17:07 +08:00
|
|
|
<pre>
|
|
|
|
{this.props.error.options.method} {this.props.error.options.url}<br/><br/>
|
|
|
|
{responseText}
|
|
|
|
</pre>
|
2015-09-18 15:16:46 +08:00
|
|
|
</div>;
|
|
|
|
}
|
|
|
|
}
|