From 9ff6608d48d58b5bcff71e6803790b9c761927e4 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 29 Mar 2024 01:37:04 +0330 Subject: [PATCH] chore: rename hook data var --- src/app/listing/@nft/(.)nft/[id]/page.tsx | 2 +- src/app/listing/nft/[id]/_components/nft-card.component.tsx | 2 +- src/hooks/use-nft.hook.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/listing/@nft/(.)nft/[id]/page.tsx b/src/app/listing/@nft/(.)nft/[id]/page.tsx index 0335656..38af470 100644 --- a/src/app/listing/@nft/(.)nft/[id]/page.tsx +++ b/src/app/listing/@nft/(.)nft/[id]/page.tsx @@ -13,7 +13,7 @@ import { useNFT } from '~hooks'; const NFTModal = () => { const { id: nftID } = useParams<{ id: string }>(); const { back } = useRouter(); - const { data: nft, isPending: isPendingNFT } = useNFT(BigInt(nftID)); + const { nft, isPending: isPendingNFT } = useNFT(BigInt(nftID)); const handleClose = () => { back(); diff --git a/src/app/listing/nft/[id]/_components/nft-card.component.tsx b/src/app/listing/nft/[id]/_components/nft-card.component.tsx index a4730bc..c290433 100644 --- a/src/app/listing/nft/[id]/_components/nft-card.component.tsx +++ b/src/app/listing/nft/[id]/_components/nft-card.component.tsx @@ -13,7 +13,7 @@ import { useNFT } from '~hooks'; export const NFTCard = () => { const { push } = useRouter(); const { id: nftID } = useParams<{ id: string }>(); - const { data: nft, isPending: isPendingNFT } = useNFT(BigInt(nftID)); + const { nft, isPending: isPendingNFT } = useNFT(BigInt(nftID)); const handleCancelClick = () => { push(routeConst.listing); diff --git a/src/hooks/use-nft.hook.ts b/src/hooks/use-nft.hook.ts index 4a5e6a2..6b9d8bf 100644 --- a/src/hooks/use-nft.hook.ts +++ b/src/hooks/use-nft.hook.ts @@ -5,7 +5,7 @@ import { useMetadata } from './use-metadata.hook'; export const useNFT = (tokenID: bigint) => { const [tokenURI, setTokenURI] = useState(''); - const { isPending: isPendingMetadata, ...rest } = useMetadata(tokenURI); + const { isPending: isPendingMetadata, data: nft, ...rest } = useMetadata(tokenURI); const { isPending: isPendingTokenURI, data: readTokenURI } = useReadContract({ abi: musharka721ContractABI, @@ -21,5 +21,5 @@ export const useNFT = (tokenID: bigint) => { } }, [readTokenURI]); - return { isPending: isPendingMetadata || isPendingTokenURI, ...rest }; + return { isPending: isPendingMetadata || isPendingTokenURI, nft, ...rest }; };