let metadata = allNFTs.map(async (e) => {
try {
const res = JSON.parse(e.metadata.attributes);
return res;
} catch (err) {
// throw err;
let config = {
method: "get",
url: `http://localhost:3000/api/fetch`,
header: {
"Content-Type": "application/json",
},
};
const res = await axios(config);
console.log(res.data.attributes);
return res.data.attributes;
}
});
console.log(metadata);
I want use try catch method like this but all i can get bunch of promises on my console
When i tried if statement my next.js app throwing me that error. I want to do something if e.metadata.attributes is empty or null or undefined but my app throwing errors.