Skip to content

Instantly share code, notes, and snippets.

@msrivastav13
Created January 31, 2016 01:09
Show Gist options
  • Save msrivastav13/1a812e48a6b82978e3da to your computer and use it in GitHub Desktop.
Save msrivastav13/1a812e48a6b82978e3da to your computer and use it in GitHub Desktop.
FunCommunityComponentHelper.js
({
getTopicName: function(component) {
console.log('here');
var action = component.get("c.fetchTopicName");
var self = this;
var topicvar = component.get("v.topic");
console.log(topicvar);
action.setParams({
"topicname": topicvar
});
action.setCallback(this, function(response) {
var state = response.getState();
console.log('STATE'+state);
if (component.isValid() && state === "SUCCESS") {
console.log('RESPONSE'+response.getReturnValue());
component.set("v.topic", response.getReturnValue());
}else if (state === "ERROR") {
var errors = response.getError();
if (errors) {
$A.logf("Errors", errors);
if (errors[0] && errors[0].message) {
$A.error("Error message: " +
errors[0].message);
}
} else {
$A.error("Unknown error");
}
}
});
$A.enqueueAction(action);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment