Created
January 31, 2016 01:09
-
-
Save msrivastav13/1a812e48a6b82978e3da to your computer and use it in GitHub Desktop.
FunCommunityComponentHelper.js
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
({ | |
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