From 936edd41d7ccecb280b9251632c5038cec334fec Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 13 Nov 2015 13:43:46 -0700 Subject: [PATCH] New Ajax Error util --- app/utils/ajax-error-new.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 app/utils/ajax-error-new.js diff --git a/app/utils/ajax-error-new.js b/app/utils/ajax-error-new.js new file mode 100644 index 0000000..37031f2 --- /dev/null +++ b/app/utils/ajax-error-new.js @@ -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}`); + }); +}