add use nft hook

pull/237/head
Tim Pechersky 2021-09-06 16:31:45 +02:00
rodzic 7eb56ae36c
commit 7a0668f83c
1 zmienionych plików z 26 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,26 @@
// import { useState, useEffect } from "react";
import { useQuery } from "react-query";
import { useToast } from ".";
import { queryCacheProps } from "./hookCommon";
import { NFTService } from "../services";
const useNFTs = (query) => {
const toast = useToast();
const getNFTStats = async (query) => {
const response = await NFTService.getNFTStats(query);
return response.data.data;
};
const nftCache = useQuery(["NFTs", query], getNFTStats, {
...queryCacheProps,
onError: (error) => {
toast(error, "error");
},
});
return {
nftCache,
};
};
export default useNFTs;