Hello
I can’t figure out how I should catch the response from server. I connecting through SOAP and getting some results after about 1s and want to show it in the front.
This is my code run in server:
var doGetCatsData = function () {
var self = this;
self._soapClient.doGetCatsData({
'countryId': self._countryId,
'localVersion': 0,
'webapiKey': self._key,
}, function (err, result) {
if (err) {
console.log(err)
} else {
console.log(result);
var catsList = result.catsList[0].item;
return catsList;
}
});
};
Meteor.methods({
'sendRequest': function(){
Allegro.createClient(options, function(err, cli) {
cli.doGetCatsData = doGetCatsData;
cli.doGetCatsData();
});
}
});
And this is my React component where I want do print the results from methot run in server side.
class App extends React.Component {
sendRequest() {
Meteor.call('sendRequest', function(error, result) {});
}
render() {
return (
<button onClick={this.sendRequest}>
Send Request
</button>
)
}
}
Thanks for any tips