mirror of
https://github.com/flarum/core.git
synced 2025-08-11 10:55:47 +02:00
update: common/components/RequestErrorModal
This commit is contained in:
committed by
Franz Liedke
parent
10f4223028
commit
18148141c3
@@ -377,7 +377,8 @@ export default class Application {
|
||||
const isDebug = app.forum.attribute('debug');
|
||||
// contains a formatted errors if possible, response must be an JSON API array of errors
|
||||
// the details property is decoded to transform escaped characters such as '\n'
|
||||
const formattedError = error.response && Array.isArray(error.response.errors) && error.response.errors.map((e) => decodeURI(e.detail));
|
||||
const errors = error.response && error.response.errors;
|
||||
const formattedError = Array.isArray(errors) && errors[0] && errors[0].detail && errors.map((e) => decodeURI(e.detail));
|
||||
|
||||
error.alert = {
|
||||
type: 'error',
|
||||
|
@@ -6,11 +6,11 @@ export default class RequestErrorModal extends Modal {
|
||||
}
|
||||
|
||||
title() {
|
||||
return this.props.error.xhr ? `${this.props.error.xhr.status} ${this.props.error.xhr.statusText}` : '';
|
||||
return this.attrs.error.xhr ? `${this.attrs.error.xhr.status} ${this.attrs.error.xhr.statusText}` : '';
|
||||
}
|
||||
|
||||
content() {
|
||||
const { error, formattedError } = this.props;
|
||||
const { error, formattedError } = this.attrs;
|
||||
|
||||
let responseText;
|
||||
|
||||
@@ -31,7 +31,7 @@ export default class RequestErrorModal extends Modal {
|
||||
return (
|
||||
<div className="Modal-body">
|
||||
<pre>
|
||||
{this.props.error.options.method} {this.props.error.options.url}
|
||||
{this.attrs.error.options.method} {this.attrs.error.options.url}
|
||||
<br />
|
||||
<br />
|
||||
{responseText}
|
||||
|
Reference in New Issue
Block a user