Changeset View
Changeset View
Standalone View
Standalone View
src/resources/js/app.js
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
// not be able to handle axios responses initiated from inside | // not be able to handle axios responses initiated from inside | ||||
// components created/mounted handlers (e.g. signup code verification link) | // components created/mounted handlers (e.g. signup code verification link) | ||||
window.axios.interceptors.response.use( | window.axios.interceptors.response.use( | ||||
response => { | response => { | ||||
// Do nothing | // Do nothing | ||||
return response | return response | ||||
}, | }, | ||||
error => { | error => { | ||||
var error_msg | let error_msg | ||||
let status = error.response ? error.response.status : 200 | |||||
if (error.response && error.response.status == 422) { | if (error.response && status == 422) { | ||||
error_msg = "Form validation error" | error_msg = "Form validation error" | ||||
$.each(error.response.data.errors || {}, (idx, msg) => { | $.each(error.response.data.errors || {}, (idx, msg) => { | ||||
$('form').each((i, form) => { | $('form').each((i, form) => { | ||||
const input_name = ($(form).data('validation-prefix') || '') + idx | const input_name = ($(form).data('validation-prefix') || '') + idx | ||||
const input = $('#' + input_name) | const input = $('#' + input_name) | ||||
if (input.length) { | if (input.length) { | ||||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |