const getData=function(url){
const pro=new Promise((resolve,reject)=>{
HTTP.call("GET",url,{auth:"admin:admin"},(error,result)=>{
if(error){
reject(error);
}else{
if(result.statusCode===200){
resolve(result.data);
}else{
reject(error);
}
}
});
});
return pro;
};
app.get("/data/subjects/", (req, res) => {
HTTP.call("GET", "http://10.1.62.120:8000/data/projects/20181113_test/experiments", {
auth: "admin:admin"
}, (error, result) => {
if (error) {
if (result.statusCode === 200) {
for (const items of result.data.ResultSet.Result) {
projectList.push(items.ID);
}
}
}
});
let p=[];
projectList.forEach(function (element) {
let url="http://10.1.62.120:8000/data/experiments/" + element + "/scans";
const pp=getData(url);
p.push(pp);
});
promise.all(p).then(values=>{
debugger;
console.log(values);
});
});
the line of promise.all has been reported incorrectly, how should I correct it?