promise.all那行报错了,应该怎么修改?

    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);
        });

    });

promise.all那行报错了,应该怎么修改?

阅读 1.7k
1 个回答

promise.all 应为Promise.all

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进