0

一直试图让这段代码工作一段时间,当我尝试在 Visual Studio 代码上“使用实时服务器打开”并检查页面时,我看不到哪里出错了,我可以看到我收到了错误:

GET  https://txvxu97okj3q.usemoralis.com:2053/server/functions/getNFT?_ApplicationId=hvSK2mZVUIMqGoMT8CJA06NJG8KPEAjrt2ZlLokl&nftId=1 400

然后还有,

{code: 141, error: 'httpResponse is not defined'}
code: 141
error: "httpResponse is not defined"

不知道错误在哪里将不胜感激任何帮助:)

Moralis.start({ serverUrl: "https://txvxu97okj3q.usemoralis.com:2053/server", appId: "hvSK2mZVUIMqGoMT8CJA06NJG8KPEAjrt2ZlLokl" });
    
function fetchNFTMetadata(NFTs){
  for (let i = 0; i < NFTs.length; i++) {
    let nft = NFTs[i];
    let id = nft.token_id;
        
//Call Moralis Cloud function -> Static JSON file 
        
  fetch("https://txvxu97okj3q.usemoralis.com:2053/server/functions/getNFT?_ApplicationId=hvSK2mZVUIMqGoMT8CJA06NJG8KPEAjrt2ZlLokl&nftId=" + id)
  .then(res => res.json())
  .then(res => console.log(res))
  }
}

async function initializeApp(){
    let currentUser = Moralis.User.current();
    if(!currentUser){
        current = await Moralis.Web3.authenticate();
    }

    const options = { address: "0x3be1812365e150157a326a8d0860a72fadee2db0", chain: "rinkeby" };
    let NFTs = await Moralis.Web3API.token.getAllTokenIds(options);
    console.log(NFTs);
    fetchNFTMetadata(NFTs.result);
}

initializeApp();

{代码:141,错误:'httpResponse 未定义'}

4

0 回答 0