1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-14 09:14:52 +01:00

hit Aquarius only when config is present (#258)

* hit Aquarius only when config is present

* more checks
This commit is contained in:
Matthias Kretschmann 2020-11-17 14:21:29 +01:00 committed by GitHub
parent 7f2a5e7515
commit 225613745c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 3 deletions

View File

@ -67,7 +67,7 @@ export default function Bookmarks(): ReactElement {
const [isLoading, setIsLoading] = useState<boolean>()
useEffect(() => {
if (!config || bookmarks === {}) return
if (!config?.metadataCacheUri || bookmarks === {}) return
const networkName = (config as ConfigHelperConfig).network

View File

@ -203,7 +203,13 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
// Get graph history data
useEffect(() => {
if (!price?.address || !price?.ocean || !price?.value) return
if (
!price?.address ||
!price?.ocean ||
!price?.value ||
!config?.metadataCacheUri
)
return
const source = axios.CancelToken.source()
const url = `${config.metadataCacheUri}/api/v1/aquarius/pools/history/${price.address}`

View File

@ -67,7 +67,7 @@ export default function PoolShares(): ReactElement {
useEffect(() => {
async function getAssets() {
if (!ocean || !accountId) return
if (!ocean || !accountId || !config?.metadataCacheUri) return
setIsLoading(true)
try {

View File

@ -112,6 +112,8 @@ export default function HomePage(): ReactElement {
const [loading, setLoading] = useState(true)
useEffect(() => {
if (!config?.metadataCacheUri) return
// TODO: remove any once ocean.js has nativeSearch typings
async function init() {
const queryResultHighest = await getAssets(

View File

@ -22,6 +22,8 @@ export default function PageTemplateAssetDetails({
const [ddo, setDdo] = useState<DDO>()
useEffect(() => {
if (!config?.metadataCacheUri) return
async function init() {
if (ddo) return

View File

@ -20,6 +20,8 @@ export default function SearchPage({
const [loading, setLoading] = useState<boolean>()
useEffect(() => {
if (!config?.metadataCacheUri) return
async function initSearch() {
setLoading(true)
const queryResult = await getResults(parsed, config.metadataCacheUri)