feat: temporarily disable the nft api
This commit is contained in:
parent
d7f8a1bef8
commit
1021abcf18
|
|
@ -25,35 +25,37 @@ export default async function handler(
|
|||
if (cache) {
|
||||
res.status(200).json(JSON.parse(cache))
|
||||
} else {
|
||||
const result = await getNFTs(query.address as string)
|
||||
await Promise.all(
|
||||
result.list.map(async (nft: Asset) => {
|
||||
if (!nft.items?.[0].mime_type && nft.items?.[0]?.address) {
|
||||
try {
|
||||
const mime_type = await cacheGet({
|
||||
key: `nft-mimetype/${nft.items[0].address}`,
|
||||
getValueFun: async () => {
|
||||
const head = await fetch(
|
||||
`${nft.items![0].address!.replace(
|
||||
IPFS_GATEWAY,
|
||||
"https://gateway.ipfs.io/ipfs/",
|
||||
)}`,
|
||||
{
|
||||
method: "HEAD",
|
||||
},
|
||||
)
|
||||
return head.headers.get("content-type")
|
||||
},
|
||||
})
|
||||
nft.items[0].mime_type = mime_type
|
||||
} catch (error) {
|
||||
console.warn(error)
|
||||
}
|
||||
}
|
||||
return nft
|
||||
}),
|
||||
)
|
||||
redis.set(redisKey, JSON.stringify(result), "EX", 60 * 60 * 24)
|
||||
res.status(200).json(result)
|
||||
// const result = await getNFTs(query.address as string)
|
||||
// await Promise.all(
|
||||
// result.list.map(async (nft: Asset) => {
|
||||
// if (!nft.items?.[0].mime_type && nft.items?.[0]?.address) {
|
||||
// try {
|
||||
// const mime_type = await cacheGet({
|
||||
// key: `nft-mimetype/${nft.items[0].address}`,
|
||||
// getValueFun: async () => {
|
||||
// const head = await fetch(
|
||||
// `${nft.items![0].address!.replace(
|
||||
// IPFS_GATEWAY,
|
||||
// "https://gateway.ipfs.io/ipfs/",
|
||||
// )}`,
|
||||
// {
|
||||
// method: "HEAD",
|
||||
// },
|
||||
// )
|
||||
// return head.headers.get("content-type")
|
||||
// },
|
||||
// })
|
||||
// nft.items[0].mime_type = mime_type
|
||||
// } catch (error) {
|
||||
// console.warn(error)
|
||||
// }
|
||||
// }
|
||||
// return nft
|
||||
// }),
|
||||
// )
|
||||
// redis.set(redisKey, JSON.stringify(result), "EX", 60 * 60 * 24)
|
||||
res.status(200).json({
|
||||
list: [],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue