New Ajax Error util

This commit is contained in:
Matthew Dillon 2015-11-13 13:43:46 -07:00
parent 28e82d59ba
commit 936edd41d7

View 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}`);
});
}