Skip to content
Snippets Groups Projects
Commit 5b74abc6 authored by corentindrouet's avatar corentindrouet Committed by Romain Soufflet
Browse files

Fix toaster message (#389)

parent 9ec8cdbc
No related branches found
No related tags found
No related merge requests found
......@@ -51,8 +51,8 @@ export default Ember.Controller.extend({
this.transitionToRoute('protected.apps');
this.toast.success('The application has been deleted');
})
.catch((reason) => {
this.toast.error(reason.errors[0].title);
.catch(() => {
this.toast.error('The application can\'t be deleted');
});
}
},
......
......@@ -52,9 +52,9 @@ export default Ember.Controller.extend({
this.set('loadState', false);
this.transitionToRoute('protected.users');
this.toast.success('User has been created sucessfully');
}, (errorMessage) => {
}, () => {
this.set('loadState', false);
this.toast.error('Cannot create new user : ' + errorMessage);
this.toast.error('Cannot create user');
});
});
}
......
......@@ -43,7 +43,7 @@ export default Ember.Controller.extend({
}), 0);
})
.catch((err) => {
this.toast.error(err.errors[0].detail, 'Account not created');
this.toast.error('Some fields you entered are invalids', 'Account not created');
return err.responseJSON;
})
.finally(() => {
......
......@@ -152,8 +152,8 @@ export default Ember.Controller.extend({
.then(({ validations }) => {
if (validations.get('isInvalid') === true) {
this.toast.error(this.get('model.validations.attrs.firstname.messages'));
return defer.reject(this.get('model.validations.attrs.firstname.messages'));
this.toast.error(this.get('model.validations.attrs.firstName.messages'));
return defer.reject(this.get('model.validations.attrs.firstName.messages'));
}
this.model.save()
......@@ -175,8 +175,8 @@ export default Ember.Controller.extend({
.then(({ validations }) => {
if (validations.get('isInvalid') === true) {
this.toast.error(this.get('model.validations.attrs.lastname.messages'));
return defer.reject(this.get('model.validations.attrs.lastname.messages'));
this.toast.error(this.get('model.validations.attrs.lastName.messages'));
return defer.reject(this.get('model.validations.attrs.lastName.messages'));
}
this.model.save()
......
......@@ -41,7 +41,7 @@ export default Ember.Controller.extend({
})
.catch((err) => {
this.set('loadState', 0);
this.toast.error(err.errors[0].detail, 'Account not created');
this.toast.error('Some fields you entered are invalids.', 'Account not created');
return err.responseJSON;
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment