From 1021abcf187a3dd4fa51dab3b7f2bd108e5e65e3 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 27 Mar 2023 17:45:17 +0100 Subject: [PATCH] feat: temporarily disable the nft api --- src/pages/api/nfts.ts | 62 ++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/src/pages/api/nfts.ts b/src/pages/api/nfts.ts index b832cc5f..c703dad2 100644 --- a/src/pages/api/nfts.ts +++ b/src/pages/api/nfts.ts @@ -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: [], + }) } }