kopia lustrzana https://github.com/bugout-dev/moonstream
add use nft hook
rodzic
7eb56ae36c
commit
7a0668f83c
|
@ -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;
|
Ładowanie…
Reference in New Issue