Wait to load until currentUser returns
This commit is contained in:
parent
eb1a8bb6e3
commit
e36d327f36
12 changed files with 85 additions and 84 deletions
|
@ -7,23 +7,23 @@ export default Ember.Controller.extend({
|
|||
|
||||
if (strain.get('isDirty')) {
|
||||
strain.save().then((strain) => {
|
||||
this.transitionToRoute('strains.show', strain);
|
||||
this.transitionToRoute('protected.strains.show', strain);
|
||||
}, (err) => {
|
||||
this.get('flashMessages').error(err.responseJSON.error);
|
||||
});
|
||||
} else {
|
||||
strain.deleteRecord();
|
||||
this.transitionToRoute('strains.show', strain);
|
||||
this.transitionToRoute('protected.strains.show', strain);
|
||||
}
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
let strain = this.get('strain');
|
||||
let strain = this.get('protected.strain');
|
||||
|
||||
strain.get('errors').clear();
|
||||
strain.rollback();
|
||||
|
||||
this.transitionToRoute('strains.show', strain);
|
||||
this.transitionToRoute('protected.strains.show', strain);
|
||||
},
|
||||
|
||||
},
|
||||
|
|
|
@ -7,17 +7,17 @@ export default Ember.Controller.extend({
|
|||
|
||||
if (strain.get('isDirty')) {
|
||||
strain.save().then((strain) => {
|
||||
this.transitionToRoute('strains.show', strain);
|
||||
this.transitionToRoute('protected.strains.show', strain);
|
||||
}, (err) => {
|
||||
this.get('flashMessages').error(err.responseJSON.error);
|
||||
});
|
||||
} else {
|
||||
this.transitionToRoute('strains.index');
|
||||
this.transitionToRoute('protected.strains.index');
|
||||
}
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
this.transitionToRoute('strains.index');
|
||||
this.transitionToRoute('protected.strains.index');
|
||||
},
|
||||
|
||||
},
|
||||
|
|
Reference in a new issue