I have an object that is the result of a Meteor.call(...function, (error, result)) I declare the object on my client myObject = result This call takes place when a user clicks a button
Now, how can I put this variable into another meteor call that I am now making within a Router.route (Iron router)? As of now, it is undefined.
The values within this object are already defined on the server within a function. I am really passing this object from the server,to the client, and back around to the server again. Can I store it on the server to be used in other function?
I read that storing global variables on the server can mess things up for other user when they set values to these variables. Is this correct?
e.g. the next call but the myObject is undefined
Router.route('/home/', {
name: 'home',
waitOn: function () {
},
action: function () {
// putting 'myObject' into call to pass onto the server
Meteor.call('toUseTheObjectOnServer', myObject, function (error, response) {
if (error) {
console.log(error)
} else {
console.log(response)
}
})
}
if (this.ready())
this.render('home');
else
this.render('Loading');
}
});
Aucun commentaire:
Enregistrer un commentaire