wait until unswer is ready

This commit is contained in:
GotPPay
2018-03-30 11:52:04 +02:00
parent 431daa3182
commit f163dde5b2
2 changed files with 3 additions and 7 deletions

View File

@@ -33,10 +33,10 @@ getDataFromWPJSON = function (sourceUrl, page = 1, maxPosts = 10) {
}
module.exports = {
getAnswerFromWP : function (sourceUrl){
getAnswerFromWP : async function (sourceUrl){
//This function will extract needed data from JSON, which we got from getDataFromWPJSON
//At the moment, it's taking titles and creates answer
return new Promise((resolve,reject)=>{
return await new Promise((resolve,reject)=>{
getDataFromWPJSON(sourceUrl).then(rawData=>{
let result='';
rawData.forEach(post=>{