Created
June 22, 2020 11:08
-
-
Save olopsman/1e61a0b0158be7770e700168997ca718 to your computer and use it in GitHub Desktop.
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
| apexPromise : function(component, methodName, params) { | |
| return new Promise($A.getCallback(function(resolve, reject) { | |
| var action = component.get(methodName); | |
| action.setParams(params); | |
| action.setCallback(self, function(res) { | |
| var state = res.getState(); | |
| if(state === 'SUCCESS') { | |
| resolve(res.getReturnValue()); | |
| } else if(state === 'ERROR') { | |
| reject(action.getError()) | |
| } | |
| }); | |
| $A.enqueueAction(action); | |
| })); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment