Last active
April 19, 2018 13:02
-
-
Save bsylvain/9487b0851da494e67faf5db5021ab6a6 to your computer and use it in GitHub Desktop.
Button triggering an API call than can fail or succeed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember' | |
export default Ember.Controller.extend({ | |
isFailure: false, | |
isSuccess: false, | |
actions: { | |
somethingToDo(){ | |
something.do().then(()=>{ | |
this.set('isFailure',false); | |
this.set('isSuccess',true); | |
},()=>{ | |
this.set('isFailure',true); | |
this.set('isSuccess',false); | |
} | |
); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment