Skip to content
Snippets Groups Projects
Commit 5f0e0d3f authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire: Committed by Reiter, Christoph
Browse files

Add generic XHR error handling

parent fed44adb
No related branches found
No related tags found
No related merge requests found
......@@ -8,10 +8,9 @@ import {html} from 'lit-element';
import {i18n} from './i18n.js';
import VPULitElementJQuery from 'vpu-common/vpu-lit-element-jquery';
import * as commonUtils from 'vpu-common/utils';
import * as utils from "./utils";
import select2CSSPath from 'select2/dist/css/select2.min.css';
import {send as notify} from "vpu-common/notification";
import bulmaCSSPath from "bulma/css/bulma.min.css";
import * as error from "vpu-common/error";
select2(window, $);
......@@ -114,18 +113,7 @@ class PersonSelect extends VPULitElementJQuery {
results: results
};
},
error: function (jqXHR, textStatus, errorThrown) {
if (textStatus !== "abort") {
const body = jqXHR.responseJSON !== undefined && jqXHR.responseJSON["hydra:description"] !== undefined ?
jqXHR.responseJSON["hydra:description"] : textStatus;
notify({
"summary": i18n.t('person-select.error-summary'),
"body": body,
"type": "danger",
});
}
}
error: error.xhrError
}
}).on("select2:select", function (e) {
// set custom element attributes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment