Below is my HTML, Client and Server JS. The issue I am having is that at first my helper function returns nothing because it takes a second for the server call to return data.
What I need is a way for the HTML to update when the data is eventually returned to the Client in the helper function.
HTML
{{#each matches}}
{{>match}}
{{/each}}
Client JS
Template.matches.helpers({
matches: function() {
Meteor.call('callAuthorize', function(error, response){
return response.matches;
})
},
Server JS
Meteor.methods({
callAuthorize: function () {
//load Future
Future = Npm.require('fibers/future');
var myFuture = new Future();
//call the function and store its result
client.authorize(
"FB_Auth",
"FB_Id",
function () {
client.getHistory( function (error, data) {
myFuture.return(data);
});
})
return myFuture.wait();
}
});
}