0
Что я делаю, это загрузка идентификаторов из базы данных Parse, и для каждого Id я хочу вызвать httpRequest в Facebook Api. Проблема в том, что httpRequest, похоже, не работает, когда нет ответа. Success (он завершает процесс) вызывает внутри себя.Parse Cloud Code: Как перебирать httpRequest?
Это то, что я до сих пор:
Parse.Cloud.define("hello", function(request, response) {
var query = new Parse.Query("Location");
query.find({
success: function(results) {
console.log(results);
for (var i = 0; i < results.length; ++i)
var locationId = results[i].get("locationId");
console.log(locationId);
Parse.Cloud.httpRequest({
url: 'https://graph.facebook.com/v2.2/'+locationId+'/events?access_token='+accessToken,
success: function(httpResponse) {
console.log(httpResponse.data);
response.success("result");
},
error:function(httpResponse){
console.error(httpResponse.message);
response.error("Failed to login");
}
});
...
Есть идеи?