0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-26 02:50:28 +01:00

Update error handling

Dieser Commit ist enthalten in:
Angus McLeod 2020-04-14 23:08:02 +10:00
Ursprung ebab021916
Commit bab2c95cfe

Datei anzeigen

@ -89,15 +89,15 @@ export default {
animateInvalidFields() { animateInvalidFields() {
Ember.run.scheduleOnce('afterRender', () => { Ember.run.scheduleOnce('afterRender', () => {
let query = '.invalid input[type=text], .invalid textarea, .invalid input[type=checkbox], .invalid .select-kit'; let $element = $('.invalid input[type=text], .invalid textarea, .invalid input[type=checkbox], .invalid .select-kit');
let $element = $(query);
let scrollTop = $(query).length ? $(query).offset().top - 200 : 0;
if ($element.length) {
$([document.documentElement, document.body]).animate({ $([document.documentElement, document.body]).animate({
scrollTop scrollTop: $(query).offset().top - 200
}, 400, function() { }, 400, function() {
$(query).wiggle(2, 100); $(query).wiggle(2, 100);
}); });
}
}); });
}, },
@ -179,6 +179,7 @@ export default {
type: 'PUT', type: 'PUT',
data: { fields } data: { fields }
}).catch(response => { }).catch(response => {
console.log(response)
if (response && response.responseJSON && response.responseJSON.errors) { if (response && response.responseJSON && response.responseJSON.errors) {
let wizardErrors = []; let wizardErrors = [];
response.responseJSON.errors.forEach(err => { response.responseJSON.errors.forEach(err => {