Last active
April 7, 2018 02:04
-
-
Save paustint/e59e811f52967ede807fc445c41813c2 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
({ | |
searchAccounts: function(component, searchTerm, localFranchiseAcctId) { | |
return new Promise(function (resolve, reject) { | |
// Get jobs from controller | |
var action = component.get("c.searchAccounts"); | |
action.setParams({ | |
searchTerm: searchTerm, | |
}); | |
action.setCallback(this, function(results) { | |
utils.log('searchAccounts() results', results); | |
if(results.getState() === 'SUCCESS') { | |
utils.log('results:', results.getReturnValue()); | |
resolve(results.getReturnValue()); | |
} else if (results.getState() === 'ERROR') { | |
utils.log('searchAccounts() ERROR', results.getError()); | |
$A.log("Errors", results.getError()); | |
reject(results.getError()); | |
} | |
}); | |
$A.enqueueAction(action); | |
}) | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment