New Ajax Error util
This commit is contained in:
parent
28e82d59ba
commit
936edd41d7
1 changed files with 7 additions and 0 deletions
7
app/utils/ajax-error-new.js
Normal file
7
app/utils/ajax-error-new.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
export default function ajaxErrorNew(error, flash) {
|
||||
flash.clearMessages();
|
||||
error.errors.forEach((error) => {
|
||||
const source = error.source.pointer.split('/');
|
||||
flash.error(`${source[source.length-1].replace(/([A-Z])/g, ' $1').capitalize()} - ${error.detail}`);
|
||||
});
|
||||
}
|
Reference in a new issue