Show validation errors on save

Fixes #17.
This commit is contained in:
Matthew Dillon 2015-10-14 10:27:18 -07:00
parent 007de178d8
commit 8577c38a9f
11 changed files with 40 additions and 29 deletions

View file

@ -1,4 +1,5 @@
import Ember from 'ember';
import ajaxError from '../../../../utils/ajax-error';
export default Ember.Controller.extend({
actions: {
@ -18,10 +19,8 @@ export default Ember.Controller.extend({
this.get('store').unloadAll();
}
this.transitionToRoute('protected.users.show', user);
}, (err) => {
err.errors.forEach((error) => {
this.get('flashMessages').error(error.detail);
});
}, () => {
ajaxError(user.get('errors'), this.get('flashMessages'));
});
} else {
this.transitionToRoute('protected.users.show', user);