-1

我有下面的代码片段,这给了我一个错误。我从长度为 1 的 getFilteredList 得到响应,并且它具有正确的 json 数据。但不知道为什么它给出错误。

TypeError:无法读取 null 的属性“then”

getFilteredList(group, feature).then(r=>{ //here I am getting error. 
    if(r.data.response_code == "1")
    {
      const columnName = "ColumnName";
      const Codes = r.data.response_message.map(x => x[columnName]);
      Codes.forEach(code=> {
        let store = getStoreValue(code);
        getDetailsById(id, datastore)
        .then(r=>{
          res.status(200).send(r.data);
        }).catch(e=>{
          parseError(e, res);
        });
      })
    }
  }).catch(e=>{
      parseError(e, res);
    });
}

有人可以帮忙吗。

getFilteredList() 是另一个节点 js 服务,它本身返回 json 数据,我可以在日志中看到该数据。下面是它返回的数据。

{"CODE":"AGR","GRP":"LEND","FEAT_CODE":"SRC_AGREE","GROUP_NAME":"Prop","FEA_NAME":"Property","DISPLAY_NAME":"Property"," ROLE_CODE":"LE"}

谢谢。

4

1 回答 1

1

我自己解决了一个错误。这是代码中的一个问题,它没有调用适当的 Web 服务,因此从本身不存在的服务获得空响应。我已更改代码以调用确切的 Web 服务,现在它工作正常。谢谢你的支持。

于 2020-02-17T15:31:59.617 回答