Commit a4493382 authored by cartcrom's avatar cartcrom Committed by GitHub

fix: searchbar fetching promise resolve fallback (#5380)

* added promise resolve fallback

* removed extra indent
parent 9662344e
......@@ -4,8 +4,10 @@ import { GenieCollection } from '../../types'
const MAX_SEARCH_RESULTS = 6
const NFT_API_URL = process.env.REACT_APP_GENIE_V3_API_URL
export const fetchSearchCollections = async (addressOrName: string, recursive = false): Promise<GenieCollection[]> => {
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/searchCollections`
if (!NFT_API_URL) return Promise.resolve([])
const url = `${NFT_API_URL}/searchCollections`
const isName = !isAddress(addressOrName.toLowerCase())
if (!isName && !recursive) {
......
import { FungibleToken } from '../../types'
const TOKEN_API_URL = process.env.REACT_APP_TEMP_API_URL
export const fetchSearchTokens = async (tokenQuery: string): Promise<FungibleToken[]> => {
const url = `${process.env.REACT_APP_TEMP_API_URL}/tokens/search?tokenQuery=${tokenQuery}`
if (!TOKEN_API_URL) return Promise.resolve([])
const url = `${TOKEN_API_URL}/tokens/search?tokenQuery=${tokenQuery}`
const r = await fetch(url, {
method: 'GET',
......
import { TimePeriod, TrendingCollection } from '../../types'
const NFT_API_URL = process.env.REACT_APP_GENIE_V3_API_URL
export const fetchTrendingCollections = async (payload: {
volumeType: 'eth' | 'nft'
timePeriod: TimePeriod
size: number
}): Promise<TrendingCollection[]> => {
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/collections/trending`
if (!NFT_API_URL) return Promise.resolve([])
const url = `${NFT_API_URL}/collections/trending`
const r = await fetch(url, {
method: 'POST',
headers: {
......
......@@ -2,8 +2,10 @@ import { unwrapToken } from 'graphql/data/util'
import { FungibleToken } from '../../types'
const TOKEN_API_URL = process.env.REACT_APP_TEMP_API_URL
export const fetchTrendingTokens = async (numTokens?: number): Promise<FungibleToken[]> => {
const url = `${process.env.REACT_APP_TEMP_API_URL}/tokens/trending${numTokens ? `?numTokens=${numTokens}` : ''}`
if (!TOKEN_API_URL) return Promise.resolve([])
const url = `${TOKEN_API_URL}/tokens/trending${numTokens ? `?numTokens=${numTokens}` : ''}`
const r = await fetch(url, {
method: 'GET',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment