Skip to content

Instantly share code, notes, and snippets.

@paustint
Last active April 7, 2018 02:04
Show Gist options
  • Save paustint/e59e811f52967ede807fc445c41813c2 to your computer and use it in GitHub Desktop.
Save paustint/e59e811f52967ede807fc445c41813c2 to your computer and use it in GitHub Desktop.
({
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