Always show CSRF error message for Ajax
This commit is contained in:
@ -7,11 +7,12 @@ CodeOceanEditorAJAX = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
ajaxError: function(response) {
|
ajaxError: function(response) {
|
||||||
var message = ((response || {}).responseJSON || {}).message || '';
|
const responseJSON = ((response || {}).responseJSON || {});
|
||||||
|
const message = responseJSON.message || responseJSON.error || '';
|
||||||
|
|
||||||
$.flash.danger({
|
$.flash.danger({
|
||||||
text: message.length > 0 ? message : $('#flash').data('message-failure'),
|
text: message.length > 0 ? message : $('#flash').data('message-failure'),
|
||||||
showPermanent: response.status === 422,
|
showPermanent: response.status === 422,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -110,11 +110,14 @@ $(document).on('turbolinks:load', function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var ajaxError = function (error) {
|
var ajaxError = function (response) {
|
||||||
|
const responseJSON = ((response || {}).responseJSON || {});
|
||||||
|
const message = responseJSON.message || responseJSON.error || '';
|
||||||
|
|
||||||
$.flash.danger({
|
$.flash.danger({
|
||||||
text: $('#flash').data('message-failure')
|
text: message.length > 0 ? message : $('#flash').data('message-failure'),
|
||||||
|
showPermanent: response.status === 422,
|
||||||
});
|
});
|
||||||
Sentry.captureException(JSON.stringify(error));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var buildCheckboxes = function () {
|
var buildCheckboxes = function () {
|
||||||
|
@ -469,9 +469,11 @@ javascript:
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ajaxError(response) {
|
function ajaxError(response) {
|
||||||
var message = ((response || {}).responseJSON || {}).message || '';
|
const responseJSON = ((response || {}).responseJSON || {});
|
||||||
|
const message = responseJSON.message || responseJSON.error || '';
|
||||||
|
|
||||||
$.flash.danger({
|
$.flash.danger({
|
||||||
text: message.length > 0 ? message : $('#flash').data('message-failure')
|
text: message.length > 0 ? message : $('#flash').data('message-failure'),
|
||||||
|
showPermanent: response.status === 422,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user